How do I schedule a cron job fortnightly?

How do I schedule a cron job fortnightly?

    Requires Free Membership to View

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 first published in May 2004

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.