0 9 * * 1-5 runs the job at 09:00 on Monday through Friday and stays quiet at the weekend. The last field holds the weekday range: cron counts Sunday as 0, so 1-5 is Monday to Friday. The day-of-month field stays a star, which keeps the two day fields from interfering.
How does cron number the weekdays?
From Sunday as 0 up to Saturday as 6 — and 7 is accepted as Sunday again, so both 0 and 7 mean the same day. That double meaning exists because different Unix variants disagreed, and it is the reason ranges like 5-7 are legal while 7-1 is an error. The names SUN to SAT and MON-FRI work in every common implementation.
Does cron know about public holidays?
No. There is no holiday calendar anywhere in cron, so a report scheduled for weekdays will also land in an empty office on 3 October or 1 May. The usual fix is a guard inside the script: look the date up in a list of holidays and exit early. Keeping the check in the script rather than the schedule also means one place to update each year.
Why should the day-of-month field stay a star?
Because as soon as both day fields are restricted, cron switches from AND to OR: 0 9 1 * 1-5 does not mean “the 1st, if it is a weekday”, it means “on the 1st and on every weekday”. The manual page crontab(5) states this explicitly, and it is the single most misread rule in the whole syntax.
How to add the expression
- Write the weekday range in the fifth field, either as 1-5 or as MON-FRI.
- Leave the day-of-month field as a star, otherwise the OR rule kicks in.
- Add the line 0 9 * * 1-5 with your command and save the crontab.
- If holidays matter, add a date check at the top of the script instead of changing the schedule.