PDA

View Full Version : [ubuntu] cron tab help ?



rompstar420
November 21st, 2008, 05:25 AM
currently my command my line in crontab is like this:

01 01 * * * perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.mydomain.com

this is to update

I would like to update it to schedule every 5 minutes? how do I do that? Just wanted to confirm I am doing this right, crontab newbie.

Thanks!

jrib
November 21st, 2008, 12:44 PM
From 'man 5 crontab':

Step values can be used in conjunction with ranges. Following a range with ‘‘/<number>’’ specifies skips of the number’s value through the range. For example, ‘‘0-23/2’’ can be used in the hours field to specify command execution every other hour (the alternative in the V7 stan‐ dard is ‘‘0,2,4,6,8,10,12,14,16,18,20,22’’). Steps are also permitted after an asterisk, so if you want to say ‘‘every two hours’’, just use ‘‘*/2’’.

So */5 in the minute field seems to be what you want.

rompstar420
November 21st, 2008, 03:56 PM
so this is right ?

05 * * * * perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.mydomain.com

how about the rest of the command, is that ok ?

jrib
November 21st, 2008, 03:58 PM
nope. */5, not 05

linux_tech
November 21st, 2008, 04:08 PM
0-55/5 should work also

hictio
November 21st, 2008, 04:10 PM
This is the whole thing:



*/5 * * * * perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.mydomain.com