[Wolves] Baffled by cron (eedjit alert)

David Goodwin dg at clocksoft.com
Mon May 23 09:55:15 BST 2005


> OK, that works fine, so obviously I am doing something wrong.
> 
> So perhaps there is something I don't understand about the way you
> write tasks for cron: can you simply put command lines in, or not?  Is
> it a matter of creating shell scripts instead?  Is there a protocol
> for this, I can't clearly find one by Googling and quite frankly the
> man page is opaque to me.
> 
> Yours in abject ignorance,
> 


Hi,

The main things to remember for cron, are:

1) Any commands started from it probably won't have a "complete" 
environment (e.g. $PATH etc) so you'll often need to declare these in 
scripts

2) stdout is often redirected to /dev/null once you know it's working - 
so you don't get zillions of pointless emails

3) As a convienance there are /etc/cron.{weekly|hourly|daily} - if you 
plonk a script in there it will run every so often. (For some reason 
I've found it doesn't like file names that contain a dot (so doit.sh 
won't work, but doit would).

4) I (at least) normally write a script, adn then call that script from 
cron, the advantages of this are :
   - A script is easier to write and debug
   - You might want to call the script manually sometime
   - Crontabs get messy and hard to read when you flatten multiple lines 
into one.



Hope that's some help

David.
-- 
David Goodwin
w: http://www.clocksoft.com
e: david.goodwin at clocksoft.com
t: 0121 313 3850



More information about the Wolves mailing list