The expression
0 9-17 * * 1-5
Runs on the hour at 09:00, 10:00, 11:00 … 17:00, Monday to Friday: nine runs a day, 45 a week.
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 |
at minute 0 |
| Hour | 9-17 |
every hour from 9 to 17, both included |
| Day of month | * |
any day |
| Month | * |
every month |
| Day of week | 1-5 |
Monday to Friday |
Ranges in cron include both ends, so 9-17 contains 17 and the last run is at 17:00. If the working day ends at 17:00 and you don't want a run then, use 9-16 (eight runs, last at 16:00). Sunday is 0 or 7; MON-FRI works in place of 1-5.
Variants
| Schedule | Expression |
|---|---|
| Every hour, 9:00 to 16:00 (no run at 17:00) | 0 9-16 * * 1-5 |
| Every hour at half past, 9:30 to 17:30 | 30 9-17 * * 1-5 |
| Every 2 hours during the day (9, 11, 13, 15, 17) | 0 9-17/2 * * 1-5 |
| Every 30 minutes during business hours | */30 9-17 * * 1-5 |
| Every 5 minutes during business hours | */5 9-17 * * 1-5 |
| Every hour, all day, every day | 0 * * * * |
| A lunch break: 9 to 12 and 14 to 17 | 0 9-12,14-17 * * 1-5 |
Hour lists and ranges can be combined with commas, which is how the lunch-break row skips 13:00.
Where to write it
- crontab (Linux, macOS):
0 9-17 * * 1-5 /usr/local/bin/poll.shincrontab -e. The hours are the server's local hours, so "9 to 5" means 9 to 5 wherever the server thinks it is. - GitHub Actions:
on: schedule: - cron: '0 9-17 * * 1-5'uses UTC hours. For 9 to 5 in Central European Time shift by one hour in winter (0 8-16 * * 1-5) and two in summer; GitHub has no time-zone setting for schedules. - Kubernetes CronJob:
schedule: "0 9-17 * * 1-5"withtimeZone: "Europe/Berlin"keeps the hours local through daylight saving changes. - AWS EventBridge:
cron(0 9-17 ? * MON-FRI *). The?in day of month is required, and day names avoid EventBridge's 1 = Sunday numbering.
Common mistakes
* 9-17 * * 1-5runs every minute. A*in the minute field means all 60 minutes of each of those hours: 540 runs a day. See every minute between 9 and 5.- Expecting
9-17to stop at 16:59. It doesn't: 17:00 is a run. - Time zone drift. A UTC schedule moves by an hour against local time twice a year in places with daylight saving.
See all nine daily runs in the Cron Expression Parser.