Cron expression for every minute

* * * * *

Five stars is the shortest schedule cron can express: the job starts once a minute, every minute of every day, 1,440 times in a day.

Runs when: every minute; every hour; every day of month; every month; any day of week.

Change it in the cron expression generator

How the five fields read

FieldValueReads as
Minute*every value
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

A slow run starts a second copy

If one run takes longer than 60 seconds, the next minute starts another copy on top of it, and a busy server can end up with dozens. Wrap the command in flock on Linux, or set concurrencyPolicy: Forbid on a Kubernetes CronJob. If the work is really continuous, a long-running worker is a better design than a once-a-minute job.

Variations of every minute

ExpressionWhat it does
* 9-17 * * 1-5Every minute from 09:00 to 17:59, Monday to Friday.
*/2 * * * *Every second minute: :00, :02, :04 and so on.
* 0-6 * * *Every minute overnight, from 00:00 to 06:59.

The same schedule in four tools

Linux crontab

* * * * * /path/to/command

Add it with crontab -e. It runs in the machine's time zone.

Kubernetes CronJob

spec:
  schedule: "* * * * *"
  timeZone: "Etc/UTC"
  concurrencyPolicy: Forbid

timeZone 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: '* * * * *'

GitHub Actions cannot run this. Its shortest schedule is every 5 minutes, and runs can start late when GitHub is busy. Scheduled workflows in public repositories are disabled after 60 days without repository activity.

AWS EventBridge

cron(* * * * ? *)

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 minute

Can I run a job every 30 seconds with cron?
Not directly, because the smallest unit is a minute. The usual workaround is two entries, where the second one waits first: * * * * * sleep 30; /path/to/command. A long-running worker or a systemd timer is cleaner.
Does every minute mean exactly on the second?
No. Cron checks the schedule once a minute and starts jobs close to the top of the minute, so the exact start time can vary by a few seconds with the load on the machine.

Nearby schedules

Scheduling jobs, pipelines and cloud infrastructure is part of my DevOps engineering work.