Overview

A cron expression has five fields: minute, hour, day of month, month, day of week. The grammar also appears in crontab, GitHub Actions, and Kubernetes CronJobs; Quartz, Spring, and AWS EventBridge rules use variants with a different field count.

Fields

Write times in the scheduler’s timezone, and check the field count for your engine.

FieldRangeNotes
Minute0-59
Hour0-23System timezone for crontab; UTC on most hosted schedulers.
Day of month1-31
Month1-12 or JAN-DEC
Day of week0-6 or SUN-SAT0 is Sunday; many implementations also accept 7.

Variants: Quartz and Spring put seconds first (and Quartz allows a year last). AWS EventBridge rules use six fields (minute, hour, day of month, month, day of week, year) and require ? in one of the two day fields.

Special characters

Use only characters your engine supports; L, W, #, and ? are not standard cron.

CharMeaningExample
*Every value* * * * * every minute
,List0 9,17 * * * at 09:00 and 17:00
-Range0 9-17 * * * hourly, 09:00 to 17:00
/Step*/15 * * * * every 15 minutes
L W # ?Last, nearest weekday, nth weekday, no valueQuartz and EventBridge only.

Common schedules

Copy a schedule, then verify the next run times before deploying.

ExpressionRuns
0 * * * *Every hour, on the hour
0 9 * * 1-5Weekdays at 09:00
0 0 1 * *Midnight on the 1st of each month
*/15 9-17 * * 1-5Every 15 minutes during weekday business hours
0 0,12 * * *Midnight and noon
0 8-20/2 * * *Every 2 hours from 08:00 to 20:00
@rebootAt startup (cron daemons only)
@hourly @daily @weekly @monthly @yearlySame as 0 * * * *, 0 0 * * *, 0 0 * * 0, 0 0 1 * *, 0 0 1 1 *

Timezones

Pin the timezone explicitly; never assume local time.

SystemDefaultHow to set
cronie (Fedora, RHEL, Arch)System zoneCRON_TZ=America/New_York in the crontab.
Debian and Ubuntu cronSystem zoneCRON_TZ is not documented; convert to the system zone or use a systemd timer.
GitHub ActionsUTCtimezone: "America/New_York" next to cron: in the schedule entry.
Kubernetes CronJobController zonespec.timeZone: "America/New_York" (stable since 1.27).
AWS EventBridge ruleUTCUse EventBridge Scheduler for a timezone.

Around daylight saving changes, cronie skips non-existent times and runs ambiguous times twice.

Operate

Guard long jobs against overlap and keep their output out of local mail.

CommandUse
crontab -l / crontab -eList / edit your crontab.
journalctl -u cron or /var/log/syslogExecution log (unit is crond on RHEL-family).
flock -n /tmp/job.lock cmdSkip a run while the previous one is still going.
MAILTO=""Stop cron mailing job output (or redirect it: >/dev/null 2>&1).

Gotchas

Avoid these; each makes a job run at the wrong time or not at all.

GotchaFix
When day of month and day of week are both restricted, cron runs when either matches. 0 0 1 * 1 fires on the 1st and on every Monday.Schedule daily and test the other condition in the script.
*/7 in the minute field means 0, 7, …, 56, then restarts at 0 next hour.Use a step that divides 60.
Cron runs with a minimal environment and no login profile.Use absolute paths and set PATH at the top.
% in a command is turned into a newline.Escape it as \%.
GitHub Actions schedules run on the default branch, at most every 5 minutes, and may start late at the top of the hour.Offset the minute (17 * * * *).
Scheduled workflows in public repos are disabled after 60 days without repository activity.Re-enable them or push a commit.