Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 know I can do this if I call a script to check, but I am curious if I can do this with just the cron.

I need to run a job once/year on the first Saturday of July If that Saturday is July 4th, run it July 5th.

share|improve this question
up vote 6 down vote accepted

It's that if that'll get you.

Hmmm. You can do it with a 2 liner:

12 12 1,2,3,5,6,7 7 6 ./
12 12 5 7 0 ./

Line 1: 12:12pm on July 1,2,3,5,6 or 7 only if it's a Saturday

Line 2: 12:12pm on July 5 only if it's a Sunday

Line 1 should cover every case except the 4th, and Line 2 should cover the case where Saturday is the 4th of July.

share|improve this answer

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.