🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.sysadmin
4 messages
4 total messages Started by Mikael Behrens Wed, 06 Jan 1993 23:32
cron and shell scripts
#2240
Author: Mikael Behrens
Date: Wed, 06 Jan 1993 23:32
27 lines
1526 bytes
I'm running a mono NeXTstation with Mamakos' SLIP software, and I have a  
shell script that retrieves my mail from my school account.  This script  
works; I've tested it several times.

I would like to have this script periodically executed by cron, but I  
can't seem to make it work.  Here's my /private/etc/crontab file:

0,15,30,45 * * * *	root /usr/lib/atrun
0 2 * * *	root	/bin/sh /usr/adm/daily >/usr/adm/daily.log 2>&1
30 3 * * 6	root	/bin/sh /usr/adm/weekly >/usr/adm/weekly.log 2>&1
30 5 1 * *	root	/bin/sh /usr/adm/monthly >/usr/adm/monthly.log  
2>&1
10 17 * * *	mikael	/bin/sh /Users/mikael/Apps/RetrieveMail


The last line is my addition.  I've been changing the times to test it.   
I've also tried this entry:

10 17 * * *	mikael	/Users/mikael/Apps/RetrieveMail

Neither works.  When the specified time rolls around nothing happens.   
I've rebooted after changing the crontab file, but that doesn't seem to  
help.  Is there a log file somewhere where errors are reported?  I've  
never messed with cron before, and I'm completely stumped.  Any help would  
be greatly apprecieated.

Mikael
Re: cron and shell scripts
#2251
Author: Wade Blomgren
Date: Thu, 07 Jan 1993 19:01
44 lines
2165 bytes
In an article, mikael@scout.utexas.edu (Mikael Behrens) writes:
|> 
|> [description of failure of cron entry for user other than root]

After upgrading to 3.0 I am having a related problem, with non-root
csh scripts run from cron.  The scripts are run, but any redirection
of output from a command in the script goes to the standard output
of the script, not to the target of the redirection.

For example, the following script (saved in, say, /tmp/script, mode 755):

#! /bin/csh
echo foo > /tmp/bar

run by the following crontab entry:

* * * * * me /tmp/script > /tmp/script.out 2>&1

results in the word "foo" appearing in /tmp/script.out, NOT /tmp/bar.

The same is true for piped output:

cat /etc/hosts | grep localhost > /tmp/bar

will send the entire hosts file to the output of the script, and nothing
goes through the grep or into /tmp/bar.

NOTE: the output files _are created_.  That is to say, in the first
simple example, the file /tmp/bar will exist, but it will be empty.

This behavior does not seem to happen when the cron command is run by
root.  When the script is run from the command line by the user account
it works fine. 

The problem does not occur on a self contained machine in my office but
it does occur on our other machines.  As I type this I realize the main
difference between my machine and the failing machines is the failing
machines are running NIS.  I'm going to turn NIS off on one of the
machines and see if the problem goes away.  In the meantime, can anyone
else who is using NIS (or not) under 3.0 comment?  Am I hallucinating?

Wade Blomgren
wade@hobbes.ucsd.edu
Re: cron and shell scripts
#2252
Author: nwc Nick Christopher
Date: Thu, 07 Jan 1993 19:59
14 lines
816 bytes
In article <86258@ut-emx.uucp> mikael@scout.utexas.edu (Mikael Behrens) writes:
> 10 17 * * *	mikael	/bin/sh /Users/mikael/Apps/RetrieveMail
> 
> 
> The last line is my addition.  I've been changing the times to test it.   
> I've also tried this entry:
> 
> 10 17 * * *	mikael	/Users/mikael/Apps/RetrieveMail
> 
> Neither works.  

try:

10 17 * * *	root su mikael -c '/Users/mikael/Apps/RetrieveMail'
Re: cron and shell scripts
#2255
Author: Mikael Behrens
Date: Thu, 07 Jan 1993 20:53
39 lines
1946 bytes
Mikael Behrens writes
| I'm running a mono NeXTstation with Mamakos' SLIP software, and I have a  
| shell script that retrieves my mail from my school account.  This script  
| works; I've tested it several times.
| 
| I would like to have this script periodically executed by cron, but I  
| can't seem to make it work.  Here's my /private/etc/crontab file:
| 
| 0,15,30,45 * * * *	root /usr/lib/atrun
| 0 2 * * *	root	/bin/sh /usr/adm/daily >/usr/adm/daily.log 2>&1
| 30 3 * * 6	root	/bin/sh /usr/adm/weekly >/usr/adm/weekly.log 2>&1
| 30 5 1 * *	root	/bin/sh /usr/adm/monthly >/usr/adm/monthly.log  
| 2>&1
| 10 17 * * *	mikael	/bin/sh /Users/mikael/Apps/RetrieveMail
| 
| 
| The last line is my addition.  I've been changing the times to test it.   
| I've also tried this entry:
| 
| 10 17 * * *	mikael	/Users/mikael/Apps/RetrieveMail
| 
| Neither works.  When the specified time rolls around nothing happens.   
| I've rebooted after changing the crontab file, but that doesn't seem to  
| help.  Is there a log file somewhere where errors are reported?  I've  
| never messed with cron before, and I'm completely stumped.  Any help  
would  
| be greatly apprecieated.
| 
| Mikael
| 

Thanks to Robert Lutwak who responded to my post, the problem is solved.   
My script uses ftp, and I had to specify it's full pathname for it to run  
under cron.

Thanks to everyone else who responded too.  The net sure is a nice  
resource (especially when the online documentation has NOTHING to say!)

Mikael Behrens
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads