Re: [Hampshire] cron riddle

Top Page
Author: Andy Smith
Date:  
To: hampshire
Subject: Re: [Hampshire] cron riddle

Reply to this message
gpg: failed to create temporary file '/var/lib/lurker/.#lk0x57c73100.hantslug.org.uk.28214': Permission denied
gpg: keyblock resource '/var/lib/lurker/pubring.gpg': Permission denied
gpg: Signature made Fri Nov 13 22:27:08 2009 GMT
gpg: using DSA key 2099B64CBF15490B
gpg: Can't check signature: No public key
Hi Chris,

On Fri, Nov 13, 2009 at 06:09:38PM +0000, Chris Dennis wrote:
> 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.


It's a pity that:

# min hour day-of-month month day-of-week command
30    3    */28         *     *           rsnapshot-script...


won't work -- I take it that would just fire on the 28th of every
month?

I think you may have to write a script that can tell when it is the
correct day.

e.g.:

SHELL=/bin/bash
# min hour day-of-month month day-of-week command
30    3    *            *     *           [ $(( $(date +%j) % 28 )) eq 0 ] && rsnapshot-script...


%j says that date should print the day number of the year, so
modulus 28 and only execute when that's 0.

Cheers,
Andy

--
http://bitfolk.com/ -- No-nonsense VPS hosting

<GeorgeWBush> I'm still banned on #ubuntu-uk though. Or should I say,
#ubuntu-anti-trans