Cron expression for every 30 minutes

Free

*/30 * * * * - Every 30 minutes.

Field by field

*/30 * * * * reads: Every 30 minutes. That is 48 runs a day.

What each field of */30 * * * * selects
FieldValueSelects
Minute*/30every 30 minutes: 0 and 30
Hour*every hour
Day of month*any day of the month
Month*every month
Day of week*any day of the week

Worth knowing

  • 48 runs a day, on the hour and the half hour.
  • 30 * * * * is a different schedule: once an hour, at half past.

Variations

  • 30 * * * *Once an hour, at half pastExplain it
  • */30 9-18 * * 1-5Every half hour during office hours on weekdaysExplain it

The same schedule elsewhere

crontab

*/30 * * * * /path/to/job.sh

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

GitHub Actions

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

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

Kubernetes CronJob

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

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

Spring @Scheduled

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

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

Quartz

0 0/30 * * * ?

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

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

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