The expression
* 9-16 * * *
Runs every minute from 09:00 through 16:59, every day: 60 runs in each of 8 hours, 480 runs a day. The last run is at 16:59; nothing runs at 17:00.
| Field | Value | Meaning |
|---|---|---|
| Minute | * |
every minute |
| Hour | 9-16 |
hours 9 through 16 |
| Day of month | * |
every day |
| Month | * |
every month |
| Day of week | * |
every day of the week |
A range in the hour field includes the whole hour at both ends. 9-16 covers 9:00 to 16:59, which is what "between 9 and 5" usually means. Writing 9-17 would keep going until 17:59, an extra hour.
Variants
| Schedule | Expression |
|---|---|
| Every minute, 9 to 5, weekdays only | * 9-16 * * 1-5 |
| Every minute 9:00 to 17:00 inclusive | two lines: * 9-16 * * * and 0 17 * * * |
| Every minute, 9:00 to 17:59 | * 9-17 * * * |
| Every 5 minutes, 9 to 5 on weekdays | */5 9-17 * * 1-5 |
| Every hour, 9 to 5 on weekdays | 0 9-17 * * 1-5 |
| Every minute, all day | * * * * * |
| Every minute overnight (22:00 to 05:59) | * 22-23,0-5 * * * |
Ranges can't wrap past midnight in standard cron (22-5 is invalid in most implementations), so an overnight window is written as a list of two ranges.
Where to write it
- crontab (Linux, macOS):
* 9-16 * * * /usr/local/bin/check-queue.shincrontab -e. "9 to 5" is in the server's time zone; useCRON_TZ=(cronie) to set another. - GitHub Actions: not possible. The shortest interval GitHub runs is 5 minutes, and schedules use UTC. The closest is
*/5 13-20 * * *for 9 to 5 New York time in summer (EDT, UTC-4). - Kubernetes CronJob:
schedule: "* 9-16 * * *"withtimeZone: "Europe/Amsterdam"(or yours). Each run creates a pod, so keep the job light and setconcurrencyPolicy: Forbid. - AWS EventBridge:
cron(* 9-16 * * ? *)in six fields with?for day of week; weekdays only iscron(* 9-16 ? * MON-FRI *). Rules are in UTC.
Common mistakes
* 9-17 * * *runs until 17:59, 540 runs instead of 480.0 9-17 * * *runs once an hour, not every minute. The*in the minute field is what makes it per-minute.- Weekends included. Without
1-5in the last field, Saturday and Sunday run too. - Overlap. At this frequency, any slow run collides with the next. Use
flock -n.
Paste any expression into the Cron Expression Parser to see it in words and its next run times.