Manage Learn to apply best practices and optimize your operations.

How do I schedule a cron job fortnightly?

How do I schedule a cron job fortnightly?
A frustrating little problem. Set up cron so that it runs a script on the required day of every week, rather than on that day every second week. Inside the script put an 'if' statement. Calculate the current day as a number of days since any fixed time in the past, perhaps using date(1) for a bash/ksh/sh script. If the number of days is even, run your fortnightly job. If the number of days is odd, finish without running anything.
This was last published in May 2004

Dig Deeper on Linux servers

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.