Cron expression for every 5 minutes

Free

*/5 * * * * - Every 5 minutes.

Field by field

*/5 * * * * reads: Every 5 minutes. That is 288 runs a day.

What each field of */5 * * * * selects
FieldValueSelects
Minute*/5every 5 minutes: 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 and 55
Hour*every hour
Day of month*any day of the month
Month*every month
Day of week*any day of the week

Worth knowing

  • */5 means minutes 0, 5, 10 and so on to 55 - aligned to the clock, not to when the job was installed.
  • To spread load, offset it: 2-59/5 runs at 2, 7, 12… so every job on the box does not start on the same second.
  • This is the shortest schedule GitHub Actions accepts, and under load its runs can start several minutes late.

Variations

  • 2-59/5 * * * *Every 5 minutes, offset by 2 minutesExplain it
  • */5 9-17 * * 1-5Every 5 minutes during office hours on weekdaysExplain it
  • 0,5,10,15,20,25,30,35,40,45,50,55 * * * *The same schedule, written out in fullExplain it

The same schedule elsewhere

crontab

*/5 * * * * /path/to/job.sh

Runs in the machine's local timezone. crontab -e to edit.

GitHub Actions

on:
  schedule:
    - cron: "*/5 * * * *"

Always UTC. Nothing more often than every 5 minutes, and runs can start late when GitHub is busy.

Kubernetes CronJob

spec:
  schedule: "*/5 * * * *"
  timeZone: "Asia/Kolkata"

timeZone needs Kubernetes 1.27 or later; without it the controller's zone applies, usually UTC.

Spring @Scheduled

@Scheduled(cron = "0 */5 * * * *")

Six fields: seconds come first. Days are written as names, which Spring and cron read alike.

Quartz

0 0/5 * * * ?

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/5 * * * ? *)

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/5:00
Persistent=true

Persistent=true runs a job that was missed while the machine was off, once it is back.