Run a Cron Job Every Hour During Business Hours
0 9-17 * * 1-5 runs on the hour from 09:00 through 17:00, Monday to Friday — nine runs a day, none at night or at weekends. Ranges in cron are inclusive: 9-17 includes 17:00, so the last run is at 5 p.m., not just before it.
0 9-17 * * 1-5In plain English: At minute 0, past hour 9 through 17, on Monday through Friday.
Field by field
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | 0 |
| Hour | 9-17 | 9 through 17 |
| Day of month | * | every day |
| Month | * | every month |
| Day of week | 1-5 | Monday through Friday |
Variations
0 9-16 * * 1-5last run at 16:00, so nothing fires at 5 p.m.*/30 9-17 * * 1-5every 30 minutes in the same window0 8-18 * * 1-6longer hours, Monday to SaturdayTweak any of these in the crontab explainer to see the schedule in plain English and its next run times.
Frequently asked questions
Does 9-17 include 5 p.m.?
Yes. Cron ranges are inclusive, so 9-17 matches 17:00 too. Use 9-16 if the job must not run at 5 p.m.
How do I use business hours in another time zone?
Cron uses the server's time zone. Convert the hours to the server's zone (and watch for daylight-saving changes), or use a cron that supports a CRON_TZ=Europe/London line above the job.
New to cron syntax? Read Cron Expressions Explained, Field by Field. Job not firing? Work through Cron Job Not Running? 10 Things to Check.