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

Attachment: signature.asc
Description: Digital signature

-- 
Please post to: [email protected]
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--------------------------------------------------------------

Reply via email to