-   Linux - General (
-   -   Configure cron entry to run every other Friday? (

MarkEHansen 10-14-2010 02:54 PM

Configure cron entry to run every other Friday?
I have a requirement that a job run at a particular time every other Friday. I was wondering if I can configure cron to do this - perhaps using the /step feature?

For example, can I do the following?

0 21 * * 5/2 /my/command

If this works, how does it decide when to begin skipping? In other words, where is the first Friday? Is it the first Friday of the Year? of the Month?

I would just try it, but it would be an awful long time to wait to see whether or not it is working.


moesplace 10-14-2010 03:13 PM

Since my version of cron doesn't support the step feature, I've come up with another solution to this very question.
I've written logic into my script to check for the existence of a "lock" file. If the lock file exists, simply remove it and exit, if it does not exist, do whatever needs doing, create the lock file and exit.

This way my cron entry is simply
0 21 * * 5

All times are GMT -5. The time now is 11:27 PM.