cron job every 5 hours
youshi10 at u.washington.edu
Mon Jul 16 04:55:22 UTC 2007
Olivier Nicole wrote:
>> I want to run an updater script, every 5 hours and x minutes. I thought
>> to use:
>> minute 5 * * * root path/to/scriptname
>> but that looks like it only works once a day, i want it to go every 5 hours
>> not justa at 5 in the monrning.
> You could sechedule you jor at 5, 10, 15 and 20 on monday, then 1, 6,
> 11, 16 and 21 on Tuesday and etc, but as the number of hours per week
> is not a multiple of 5, next week Monday would be at 2, 7, 12, 17 and
> 22, and that would not work with cron.
> If you absolutely need it to be 5 hours (6 hours would work nicely
> with cron) have your job restart itself with at(1).
> Cron must work on a weekly sechedule.
minute */5 * * * root path/to/scriptname
will do the trick.
Substitute the * in */5 for your desired start time (* being 0).
PS crond won't do 5 hours and every x number of minutes per job (5 hours
+ x mins from end to start), just a flat amount of time (5 hours apart
from start to start). If you need that type of 'precision', at will
solve that like Olivier said if you place it at the end of the command.
More information about the freebsd-questions