The expression
*/30 * * * 1-5
Runs at minute 0 and 30 of every hour, all day, Monday through Friday: 48 runs per weekday, 240 a week. Nothing runs from Saturday 00:00 until Monday 00:00.
| Field | Value | Meaning |
|---|---|---|
| Minute | */30 |
at minute 0 and 30 |
| Hour | * |
every hour |
| Day of month | * |
every day |
| Month | * |
every month |
| Day of week | 1-5 |
Monday (1) to Friday (5) |
Cron numbers the days of the week from Sunday: 0 is Sunday, 1 Monday … 6 Saturday, and 7 is also accepted as Sunday. Most implementations take names too, so */30 * * * MON-FRI is the same schedule and harder to get wrong.
Variants
| Schedule | Expression |
|---|---|
| Every 30 minutes, 9:00 to 17:30, weekdays | */30 9-17 * * 1-5 |
| Every 30 minutes, 9:00 to 17:00, weekdays | */30 9-16 * * 1-5 plus 0 17 * * 1-5 |
| Every 30 minutes on weekends | */30 * * * 6,0 |
| Every 30 minutes, every day | */30 * * * * |
| Every hour, 9 to 5 on weekdays | 0 9-17 * * 1-5 |
| Every 5 minutes, 9 to 5 on weekdays | */5 9-17 * * 1-5 |
| Once each weekday at midnight | 0 0 * * 1-5 |
Where to write it
- crontab (Linux, macOS):
*/30 * * * 1-5 /usr/local/bin/poll-orders.shincrontab -e. Both the hours and the weekday boundaries use the server's time zone. - GitHub Actions:
on: schedule: - cron: '*/30 * * * 1-5'. The weekday is evaluated in UTC, so for a team in California (UTC-7 in summer) the schedule stops at 17:00 local time on Friday and resumes at 17:00 on Sunday. Shift the window or accept the offset. - Kubernetes CronJob:
schedule: "*/30 * * * 1-5"withtimeZone:so Monday starts at local midnight. - AWS EventBridge:
cron(0/30 * ? * MON-FRI *). Here the day of month must be?because day of week is set, and EventBridge numbers weekdays 1-7 starting at Sunday (2-6would be Monday to Friday), so use names. Rules run in UTC.
Common mistakes
*/30 * * * 0-4is Sunday to Thursday, not a work week, because 0 is Sunday.- Restricting day of month as well.
*/30 * 1-7 * 1-5doesn't mean "weekdays in the first week": when both day fields are set, standard cron runs when either matches, so it fires on days 1-7 and on every weekday. - Holidays. Cron has no calendar of public holidays. Have the script check a holiday list and exit early.
Paste any expression into the Cron Expression Parser to see it in words and its next run times.