The New Utovsky Bolshevik Show

Tue, 04 Nov 2008

Running cron fortnightly: round-up

It's a few days on from my original post, so I thought I'd give a summary of people's ideas. Just to remind you of the aim of the exercise, it's to get a cron job to run every fortnight, without using the 'date' command.

So, here are the ideas we've had:

Well, in light of the above ideas, my solution might be slightly cheaty. It depends on a Debian (or, presumably, Ubuntu system), as it takes advantage of /etc/cron.weekly. Essentially you write a script that live in /etc/cron.weekly and symlinks other scripts in and out of /etc/cron.weekly. These scripts could be stored in, for example, /etc/cron.fortnightly. It would scan through there and symlink in any that weren't in /etc/cron.weekly and remove existing symlinks to /etc/cron.fortnightly scripts.

This has the advantages of:

Of course, we should all just use 'date'...

EDIT: benji has noted that /etc/cron.weekly is by no means a Debian-specific feature. SUSE has it. Warn your distributor now.

Posted: Tue, 04 Nov 2008 21:56 | Tags: , , | Comments: 4 |