How to specify bi-weekly crontab entries by day of the week?

suvayu ali fatkasuvayu+linux at gmail.com
Sun Sep 18 10:33:26 UTC 2011


Hi,

I have been trying to figure this out but so far haven't had any
success. I want to run jobs weekly, every 4 weeks (i.e. monthly) and
every 52 weeks (i.e. yearly) on a specific time on a Monday.

I tried using the 1/<n> notation

00 2 * * 1/364  /usr/bin/rsnapshot -c /etc/rsnapshot.conf yearly
20 2 * * 1/28   /usr/bin/rsnapshot -c /etc/rsnapshot.conf monthly
40 2 * * 1      /usr/bin/rsnapshot -c /etc/rsnapshot.conf weekly

but trying to save tells me:

"/tmp/crontab.yGETuJ":1: bad day-of-week
errors in crontab file, can't install.
Do you want to retry the same edit?

However trying something like this works but then this runs on Sundays.

00 2 * * */364  /usr/bin/rsnapshot -c /etc/rsnapshot.conf yearly
20 2 * * */28   /usr/bin/rsnapshot -c /etc/rsnapshot.conf monthly
40 2 * * 0      /usr/bin/rsnapshot -c /etc/rsnapshot.conf weekly

So my question is, how do I specify jobs to be run every 2/4/<n> weeks
on any arbitrary day of the week? Is that possible or do I have to
live with only Sundays or using dates instead of day of the week?

Thanks a lot.

-- 
Suvayu

Open source is the future. It sets us free.


More information about the users mailing list