[rancid] Rancid-discuss Digest, Vol 77, Issue 6

Alan McKinnon alan.mckinnon at gmail.com
Thu Mar 23 12:11:23 UTC 2017


On 23/03/2017 13:26, Alex DEKKER wrote:
> On 22/03/17 21:42, Alan McKinnon wrote:
>> On 22/03/2017 22:02, Jones, Herschel wrote:
>>> Alan,
>>>
>>> Crontab here -
>>>
>>> # .---------------- minute (0 - 59)
>>> # |  .------------- hour (0 - 23)
>>> # |  |  .---------- day of month (1 - 31)
>>> # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
>>> # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR
>>> sun,mon,tue,wed,thu,fri,sat
>>> # |  |  |  |  |
>>> # *  *  *  *  * user-name  command to be executed
>>>
>>> * 1 * * * /usr/local/rancid/bin/rancid-run #hourly router dump
>>   ^
>> This is your problem. It runs every minute when the hour is "1", every
> minute from 01:00 to 01:59
>
> To the OP - everyone has made this particular mistake at least once :-)
>
>> The golden rule of cron is you cannot specify intervals like "every 10
> minutes" or "once a day".
>
> Don't want to stray too far off topic here, but "ISC Cron" which
> according to the ever-reliable Wikipedia article is the default cron on
> most Linux and BSDs allows for just this. My RANCID cron entry is:
>
> 29 8-22/4 * * * /usr/bin/rancid-run
>
> so at 29 minutes past every 4th hour between 0800 and 2200, it runs. I
> am not sure how this particular frequency was arrived at, but it seems
> to work for us.

That is not actually "very 4 hours", as in "at an interval but I don't 
care when it starts"

Your example really does expand to an exact list, wall clock time:
8, 12, 16, 20 o'clock

To understand what Paul Vixie made that value do, it should be 
understood like this: for every value between 8 and 22 (inclusive), run 
the job at the hour when that value is divisible by 4 without remainder. 
Or even start at 8 and keep adding 4 till you go beyond 22

The point I'm making is no matter how fancy you specify your cron 
timings, it has to come down a list of exact numbers.

8-22/4 is probably better expressed as "8,12,16,20", more obvious more 
intuitive


-- 
Alan McKinnon
alan.mckinnon at gmail.com



More information about the Rancid-discuss mailing list