Cron expression for every 5 minutes
*/5 * * * *The job runs when the minute is 0, 5, 10 and so on up to 55, which is twelve times an hour.
Runs when: every 5 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 | */5 | every 5 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
- Uptime and health checks
- Syncing a small dataset from an external API
- Refreshing a cache that feeds a dashboard
It follows the clock, not the last run
*/5 means "at every fifth minute of the hour", not "five minutes after the previous run finished". If a server restarts at 10:03, the next run is still at 10:05. If you need a gap measured from the end of the last run, schedule a loop or a lock file, not a cron interval.
Variations of every 5 minutes
| Expression | What it does |
|---|---|
*/5 9-17 * * 1-5 | Every 5 minutes during business hours on weekdays. |
2-59/5 * * * * | Every 5 minutes, offset to :02, :07, :12 and so on. |
*/5 0-6 * * * | Every 5 minutes overnight, from 00:00 to 06:55. |
The same schedule in four tools
Linux crontab
*/5 * * * * /path/to/commandAdd it with crontab -e. It runs in the machine's time zone.
Kubernetes CronJob
spec:
schedule: "*/5 * * * *"
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: '*/5 * * * *'This is the shortest interval GitHub Actions supports, and the run can still start several minutes late at busy times. Scheduled workflows in public repositories are disabled after 60 days without repository activity.
AWS EventBridge
cron(0/5 * * * ? *)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 5 minutes
- Is */5 the same as 0,5,10,15 and so on up to 55?
- Yes. They produce the same schedule, and */5 is the shorter way to write it.
- Why did my job miss a run?
- Usually the machine was off, or the cron service was down at that minute. Classic cron does not catch up on missed runs. For work that must not be skipped, use a systemd timer with Persistent=true, or a scheduler that records missed executions.
Nearby schedules
- Cron expression for every minute: Sixty runs an hour, and GitHub Actions can't do it.
- Cron expression for every 10 minutes: Half as often, at :00, :10, :20 and so on.
- All schedules and the generator
Scheduling jobs, pipelines and cloud infrastructure is part of my DevOps engineering work.