The New Utovsky Bolshevik Show

Fri, 31 Oct 2008

Running cron fortnightly

In the office, we've just been having a discussion about how to run a cron job fortnightly. This is relatively easy to do with an entry like:

03    04    *     *     4     expr `date +"%s"` / 604800 % 2 >/dev/null || run_my_script
(there are 604800 seconds in a week)

However, I was wondering how to do it without using date, because that's clearly cheating. I have an idea, but want to hear what other people come up with. Go!

NOTE: It must be actually fortnightly, the 1st and the 15th of the month won't do.

Posted: Fri, 31 Oct 2008 16:04 | Tags: , , | Comments: 5