With a little side of applesauce...

Tuesday, January 30, 2007

CRONTAB running a job every X …

I always forget the syntax for running a job every X minutes/days/months… etc… I usually have to google it, but I just found that it is actually contained in crontab(5), (on Debian):

Step values can be used in conjunction with ranges. Following a range
with ‘‘/’’ specifies skips of the number’s value through the
range. For example, ‘‘0-23/2’’ can be used in the hours field to spec‐
ify 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’’.
– crontab(5)

No comments: