[nzlug] cron

Cliff Pratt enkidu at cliffp.com
Mon Jun 9 09:23:28 NZST 2008


Nevyn wrote:
> On Sun, Jun 8, 2008 at 9:34 AM, Brendan Murray <xasperated at gmail.com>
> wrote:
>> Nevyn wrote:
>>> Does anyone know if there are any special steps required to get
>>> cron going in Ubuntu?
>>> 
>>> I'm trying to get cron to run a task for me every 5 minutes or
>>> so. So I ran
>>> 
>>> "sudo crontab -e"
>>> 
>>> as I need the job to be run as root. Entered in the following
>>> line:
>>> 
>>> */5 * * * * /usr/bin/whatever
>>> 
>>> whatever has an echo command to write a date to a log file (for 
>>> initial testing). However, it appears the script never gets run.
>>> I tried running the script manually and it does as it's supposed
>>> to do.
>>> 
>> On debian  boxes, I've seen scripts fail to run from crontab that
>> weren't started with "#! /bin/sh" or whatever shell you want to run
>> the script as. Dunno about ubuntu but presumably they're the same.
>> 
>> 
>> This one doesn't work ----- # a cron script that doesn't work echo
>> "ping"  >> /tmp/logfile ------
>> 
>> This one does ------------- #! /bin/sh # a cron script that does
>> work echo "ping" >> /tmp/logfile
> 
> Just figured it out. Turns out crontab appears to write an error log 
> of your own tasks in your home directory under the name
> "dead.letter". So in my case, sudo -i got me into root's directory
> and having a look there "showed me the way...."
> 
*cron* does that? Are you sure? Sounds more like whatever MTA you are 
running would do that.

Cheers,

Cliff



More information about the NZLUG mailing list