Skip to main content

Free tools

Cron expression explained

When does this cron job run? Paste the expression. It is read in your browser, nothing is sent.

The five fields

A cron expression has five fields, separated by spaces: minute (0-59), hour (0-23), day of the month (1-31), month (1-12 or JAN-DEC) and day of the week (0-7 or SUN-SAT, 0 and 7 are both Sunday).

In each field, * means every value, 1-5 a range, 1,15 a list, and */10 a step: every 10th value. So */15 9-17 * * 1-5 runs every 15 minutes from 9:00 to 17:45, Monday to Friday.

The aliases are shortcuts: @hourly, @daily (or @midnight), @weekly, @monthly and @yearly (or @annually). @reboot runs once when the machine starts.

A few common ones: 0 * * * * runs at the top of every hour, 30 2 * * * at 2:30 every night, 0 0 * * 0 at midnight every Sunday, and 0 8 1 * * at 8:00 on the first day of each month.

Why a cron job did not run

  • Day of month and day of week are both set. Cron runs the job when EITHER matches, not both: 0 0 13 * 5 runs every 13th and every Friday.
  • The time zone. The server runs cron in its own zone, often UTC, not yours. Kubernetes CronJobs use the controller's zone unless you set timeZone.
  • The environment. Cron starts jobs with a minimal PATH and no shell profile, so a script that works in your terminal fails there.
  • It ran and failed, and nobody saw it: cron mails the output to a local mailbox nobody reads.

Questions

Does it support seconds?

No. Standard cron has five fields and a one-minute resolution. Six-field expressions with seconds are a Quartz and Spring extension.

Which time zone are the next runs in?

Yours, from your browser. Convert them if your server runs in UTC.

How do I know when a cron job stops running?

Use a heartbeat check. The job calls a SolidPing URL each time it finishes; if the call does not arrive on time, you get an alert.

See also