Re: [Hampshire] cron riddle

Top Page

Reply to this message
Author: Peter Salisbury
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] cron riddle
2009/11/13 Chris Dennis <cgdennis@???>:
> I'd like to run rsnapshot daily, weekly, and four-weekly (as opposed to
> monthly, which would happen after either four or five weekly runs).
>
> Is there a way to get cron to run a job four-weekly?  Google hasn't been
> any help.
>
> Someone suggested
>
> 30 3 * * Fri/4  rsnapshot-script...
>
> but that runs every Friday, not every four Fridays (at least it does on
> Debian).
>
> The nearest I've managed is
>
> 30 3 8-14 * Fri  rsnapshot-script...
>
> which should run on the second Friday of the month (i.e. any Friday
> between the 8th and 14th of the month).  At least I can be sure that
> runs on Friday, and not a different day of the week every month.
>
> Are there any clever tricks that I've missed?
>
> cheers
>
> Chris


Use anacron? From the man page:

Anacron can be used to execute commands periodically, with a frequency
specified in days. Unlike cron(8), it does not assume that the machine
is running continuously. Hence, it can be used on machines that aren't
running 24 hours a day..

HTH, Peter