Cron expression for every 30 minutes
*/30 * * * *Twice an hour, on the hour and at half past, forty-eight times a day.
Runs when: every 30 minutes; every hour; every day of month; every month; any day of week.
Change it in the cron expression generatorHow the five fields read
| Field | Value | Reads as |
|---|---|---|
| Minute | */30 | every 30 minutes |
| Hour | * | every value |
| Day of month | * | every value |
| Month | * | every value |
| Day of week | * | every value |
The next five runs
What people use it for
- Exporting analytics to a warehouse
- Sending reminder emails
- Clearing temporary files
Two ways to write the same thing
*/30 and 0,30 give identical schedules. That is harmless, but teams that mix both in one crontab often waste time during a review wondering whether they differ. Choose one style and keep it. If you want to avoid the busy :00 and :30 marks, use 5,35 or 12,42.
Variations of every 30 minutes
| Expression | What it does |
|---|---|
5,35 * * * * | Twice an hour, at :05 and :35. |
*/30 9-17 * * 1-5 | Every 30 minutes during business hours on weekdays. |
0,30 8-20 * * * | Every 30 minutes from 08:00 to 20:30. |
The same schedule in four tools
Linux crontab
*/30 * * * * /path/to/commandAdd it with crontab -e. It runs in the machine's time zone.
Kubernetes CronJob
spec:
schedule: "*/30 * * * *"
timeZone: "Etc/UTC"
concurrencyPolicy: ForbidtimeZone is stable from Kubernetes 1.27. Without it, the controller's time zone applies. Forbid stops a new run starting while the last one is still going.
GitHub Actions
on:
schedule:
- cron: '*/30 * * * *'Schedules run in UTC from the default branch, and a run can start a few minutes late when GitHub is busy. Scheduled workflows in public repositories are disabled after 60 days without repository activity.
AWS EventBridge
cron(0/30 * * * ? *)EventBridge uses six fields, with a question mark in one of the two day fields, and rules run in UTC. Weekday numbers start at Sunday = 1, so names such as MON are safer than numbers.
Questions about every 30 minutes
- Is */30 the same as 0,30?
- Yes, they give the same schedule. Use whichever your team reads faster.
- How do I run something every 45 minutes?
- Cron cannot do a true 45-minute interval. */45 fires at :00 and :45 of each hour, which leaves gaps of 45 and then 15 minutes. For an even interval, use a systemd timer or a loop with a sleep.
Nearby schedules
- Cron expression for every 15 minutes: Four runs an hour.
- Cron expression for every hour: One run an hour, at :00.
- All schedules and the generator
Scheduling jobs, pipelines and cloud infrastructure is part of my DevOps engineering work.