Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 5 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 ./script.sh
12 12 5 7 0 ./script.sh

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

 
discard

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.