[nzlug] cron

Brendan Murray xasperated at gmail.com
Sun Jun 8 09:34:00 NZST 2008


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




More information about the NZLUG mailing list