Field by field
0 */6 * * * reads: Every 6 hours, on the hour. That is 4 runs a day.
| Field | Value | Selects |
|---|---|---|
| Minute | 0 | 0 |
| Hour | */6 | every 6 hours: 00:00, 06:00, 12:00 and 18:00 |
| Day of month | * | any day of the month |
| Month | * | every month |
| Day of week | * | any day of the week |
Worth knowing
- Four runs a day, at midnight, 06:00, noon and 18:00 in the timezone the scheduler uses.
- On a server set to UTC those are 05:30, 11:30, 17:30 and 23:30 in India - check the timezone before promising anyone a time.
Variations
0 3-23/6 * * *Every 6 hours, starting at 03:00Explain it0 0,6,12,18 * * *The same schedule, written as a listExplain it
The same schedule elsewhere
crontab
0 */6 * * * /path/to/job.sh
Runs in the machine's local timezone. crontab -e to edit.
GitHub Actions
on:
schedule:
- cron: "0 */6 * * *"Always UTC. Nothing more often than every 5 minutes, and runs can start late when GitHub is busy.
Kubernetes CronJob
spec: schedule: "0 */6 * * *" timeZone: "Asia/Kolkata"
timeZone needs Kubernetes 1.27 or later; without it the controller's zone applies, usually UTC.
Spring @Scheduled
@Scheduled(cron = "0 0 */6 * * *")
Six fields: seconds come first. Days are written as names, which Spring and cron read alike.
Quartz
0 0 0/6 * * ?
One of day-of-month and day-of-week must be ?. Quartz counts days 1-7 from Sunday, so names are safer than numbers.
AWS EventBridge
cron(0 0/6 * * ? *)
Six fields, the last one the year. UTC unless the schedule sets a timezone. Days count from Sunday, as in Quartz.
systemd timer
[Timer] OnCalendar=*-*-* 00/6:00:00 Persistent=true
Persistent=true runs a job that was missed while the machine was off, once it is back.