Crontab Weekdays at 9:00 AM (0 9 * * 1-5)
Run a cron job at 9:00 AM Monday through Friday using a day-of-week range. Perfect for business-hours automation.
Detailed Explanation
Running a Cron Job on Weekdays at 9 AM
The expression 0 9 * * 1-5 runs at 9:00 AM from Monday through Friday, skipping Saturday and Sunday. The 1-5 range in the day-of-week field covers Monday (1) to Friday (5).
Field Breakdown
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | At minute 0 |
| Hour | 9 | At 9 AM |
| Day of Month | * | Any day |
| Month | * | Every month |
| Day of Week | 1-5 | Monday through Friday |
The Range Operator
The hyphen (-) creates a range of consecutive values. In the day-of-week field:
1-5= Monday, Tuesday, Wednesday, Thursday, Friday0-4= Sunday through Thursday6,0= Saturday and Sunday (weekends, using a list)
Business Hours Pattern
For more complex business-hours schedules, you can combine ranges in multiple fields:
# Every 30 minutes during business hours (9 AM - 5 PM, Mon-Fri)
*/30 9-17 * * 1-5
# At the start of each business hour
0 9-17 * * 1-5
# Every weekday at 9 AM and 5 PM
0 9,17 * * 1-5
Handling Holidays
Cron does not have a built-in concept of holidays. To skip holidays, you need to add logic in your script that checks a holiday list and exits early if the current date is a holiday.
Use Case
The quintessential business-hours schedule: daily stand-up reminders, CI pipeline triggers on workdays, weekday-only email digests, Slack channel updates, deployment window checks, and automated time-tracking prompts.