Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

crontab(5) defines the following fields:

       field         allowed values
       -----         --------------
       minute        0-59
       hour          0-23
       day of month  1-31
       month         1-12 (or names, see below)
       day of week   0-7 (0 or 7 is Sun, or use names)

and explains:

 Step values can be used in conjunction with ranges.  Following a range
 with ``/<number>'' specifies skips of the number's value through the
 range.  For example, ``0-23/2'' can be used in the hours field to specify
 command execution every other hour (the alternative in the V7 standard is

So, no biweekly Jobs, as far as my understanding goes. I'm quite sure there are workarounds, what are yours? Or did I miss something?

share|improve this question
The best answer I can find on this is here:… – Somantra Jul 3 '12 at 14:42
...and those answers on U&L would be the way I'd do it, @Somantra :-) – voretaq7 Jul 3 '12 at 14:53
@voretaq7, I'd have said it was the canonical answer, but I didn't want to come across as pedantic ;-) – Somantra Jul 3 '12 at 15:10
up vote 5 down vote accepted

You can have the thing run by cron every wednesday, then have the thing run decide if it is an even week or an odd week. for example:

week=$(date +%U)
if [ $(($week % 2)) == 0 ]; then 
    echo even week
    echo odd week
share|improve this answer
This is a nice solution, however, doesn't really answer the question itself - I'd prefer not to taint the thing with schedule logic. Maybe I can integrate this with the link @Somantra gave. – Roman Jul 3 '12 at 16:28
Alright, I must admit: this is the best solution so far. The link that @Somantra gave achieves the same results unecessarily complex IMHO (counting with UNIX time), but adding your approach directly to the cronjob (instead of into the script) in the same style makes it quite elegant. – Roman Jul 30 '12 at 13:41

Many crons (you didn't specify which you're using) support ranges. So something like

0 0 1-7,15-21 * 3

Would hit the first and third wednesdays of the month.

share|improve this answer
this is slightly more elegant than the "do it in the script" method, but remember to add a comment to your crontab (general rule of thumb: if you have more than one - or / involved it's probably worth commenting to describe the schedule) – voretaq7 Jul 4 '12 at 3:18
I suspect this is wrong; it will cause the job to be run on the 1st-7th, and 15-21st, of each month, and every Wednesday as well. This from man 5 crontab: "The day of a command’s execution can be specified by two fields — day of month, and day of week. If both fields are restricted (ie, aren’t * ), the command will be run when either field matches the current time. For example, "30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday" (my emphasis). – MadHatter Oct 10 '14 at 14:32
Actually, that depends on which cron daemon you are using. Your entry seems to be from vixie cron (included in RedHat distros). From "man crontab" on dillo's cron (Slackware): If you specify both a day in the month and a day of week, *it will be interpreted as the Nth such day in the month*. Still, a scripted solution (calculating week number) looks like the only portable solution. – AlvaroGMJ Jan 26 '15 at 14:13

Anacron is a good workaround for the limitations of cron.

  • Anacron has a Recurrence Period parameter which you can set to 14.

period delay job-identifier command

14 15 test.daily /path/to/

share|improve this answer
Unfortunately, anacron can't be used. Forgot to mention that. – Roman Jul 3 '12 at 17:41

For something that needs to run every other week use this one-liner:

0 0 * * 5 [ `expr \`date +\%V\` \% 2` -eq 0 ] && echo "execute script" 

This particular script is scheduled to run on Fridays. The week to be executed on can be adjusted by using "-eq 0" or "-eq 1"

share|improve this answer

From that explaination setting 3/2 on the week field should run the task on every other wednesday - its implicit, but i think doable.

share|improve this answer
no, this is equivalent to for(int i=3; i <=3 ; i+=2) {} since it is only going through this once, it doesn't matter if the "step" is 1 or 2. – stew Jul 3 '12 at 15:43
What @stew said. Also, there's no "week field". – Roman Jul 3 '12 at 16:30
By week field, i mean the "Day of week field' – Journeyman Geek Jul 4 '12 at 0:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.