# How do I make cron run every other Sunday on the OTHER Sunday?

I have a cron job that runs at 0 0 * * 0/2 -- i.e. every other Sunday. It just ran now, for instance. However, I want it to run on the other Sundays -- next Sunday, rather than this one. Another way of putting it: I presume it's running on even-numbered Sundays of the year, but I want it to run on odd-numbered Sundays.

I don't see anything in "man 5 crontab" that would help me with this so I presume I need to drop back to running the cronjob at 0 0 * * 0 and then do something in the command I run to check which Sunday it is. Can anyone help me with some suitable command line trickery for this?

ETA: have realised that my 0/2 doesn't do what I originally thought (every second Sunday) at all. It runs every Sunday, as long as that day of the week is divisible by two, which of course it is. D'oh. Anyway, the fundamental requirement remains: run a command on odd-numbered Sundays.

• "odd-numbered" as in "The First, Third, and Fifth Sunday"? – voretaq7 Apr 29 '13 at 21:11
• No, as in 1st, 3rd, 5th, 7th,...49th, 51st week of the year. In other words, fortnightly, on the Sundays that fall in odd-numbered weeks of the year. – Skud Apr 30 '13 at 0:23
• Sorry - cron won't do that for you. You'll need to have your script check whether it's the right week for you. (Also, if you remember me from a Certain Place - HI!!! waves) – Jenny D May 20 '13 at 10:06

• Yes, but it's modulo 2, which means it's going to run on the even numbered weeks. It might be possible to stack multiple `eval` blocks to add one and then do the modulo 2. That's ugly at best, but I suppose it might work. – Chris S Apr 28 '13 at 2:21
• From the linked answer, this looks like it has potential: `date +\%W` \% 2 > /dev/null || whatever... However, to get the odd numbered weeks, I'd want to do "&& whatever" instead of || – Skud Apr 28 '13 at 2:30