Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Source: http://www.switchplane.com/blog/how-to-run-a-cron-job-on-the-first-weekday-of-the-month/
- This will run your job at 10am on the first weekday of the month:
- #-- First weekday of the month
- # If it's Monday, and it's the 1st, 2nd or 3rd day of the month
- # Monday can be 2nd or 3rd day of month following a weekend
- 00 10 1-3 * * [ "$(date '+\%a')" == "Mon" ] && /path/to/your/job.sh
- # If it's Tues - Friday, and the 1st of the month
- 00 10 1 * * [ "$(date '+\%a')" == "Tue" ] && /path/to/your/job.sh
- 00 10 1 * * [ "$(date '+\%a')" == "Wed" ] && /path/to/your/job.sh
- 00 10 1 * * [ "$(date '+\%a')" == "Thu" ] && /path/to/your/job.sh
- 00 10 1 * * [ "$(date '+\%a')" == "Fri" ] && /path/to/your/job.sh
- #-- End first weekday of the month
Advertisement
Add Comment
Please, Sign In to add comment