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

I need to run a cronjob every 14 days on a friday i. e. every second friday. Following is the closest I can think of:

0 10 */14 * 5

I think crontab would run this cronjob at 10:00 on the 14th and 28th day of a month (and that's not even every 14 days!) if this day is a friday. This condition would not be met every second friday, of course.

Any ideas?

share|improve this question

migrated from Nov 17 '11 at 13:58

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

Crontab does not support every other friday types of specification natively, but you could do something like this I suppose:

00 10 1-7,15-21 * * [ `date +\%a` = Fri ] && yourcommand
share|improve this answer
The day range is a good idea. Why are you checking for friday with shell scripting? Shouldn't 00 10 1-7,15-21 * 5 do the same? – Leif Nov 14 '11 at 13:41
I don't know, it would make sense indeed but I never tried that solution. I know for sure that /2 does not work for weekdays although that would have been the most logical solution in my view. – PhilipCB Nov 15 '11 at 9:08
It looks like the values are not all restrictive. 00 10 1-7,15-21 * 5 ran 7 times between December 1 and 7. And additionally it runs on every friday. – Leif Dec 9 '11 at 8:33

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.