Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jul 2007 21:55:12 -0700
From:      Garrett Cooper <youshi10@u.washington.edu>
To:        Olivier Nicole <on@cs.ait.ac.th>
Cc:        dmehler26@woh.rr.com, freebsd-questions@freebsd.org
Subject:   Re: cron job every 5 hours
Message-ID:  <469AFA30.4050504@u.washington.edu>
In-Reply-To: <200707160427.l6G4Rb5q090225@banyan.cs.ait.ac.th>
References:  <000f01c7c56d$da44d640$0200a8c0@satellite> <200707160427.l6G4Rb5q090225@banyan.cs.ait.ac.th>

next in thread | previous in thread | raw e-mail | index | archive | help
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.
>
> bests,
>
> Olivier
    Something like:

    minute */5 * * * root path/to/scriptname

    will do the trick.

    Substitute the * in */5 for your desired start time (* being 0).

-Garrett

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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?469AFA30.4050504>