A cron expression packs a schedule into five fields. It's compact, which is also why it's easy to get subtly wrong. This page collects the syntax in one place, with examples you can copy and the rules that most often cause surprises.
The five fields
┌───────────── minute (0–59)
│ ┌─────────── hour (0–23)
│ │ ┌───────── day of month (1–31)
│ │ │ ┌─────── month (1–12 or JAN–DEC)
│ │ │ │ ┌───── day of week (0–7 or SUN–SAT; 0 and 7 are Sunday)
│ │ │ │ │
* * * * * command
In a user's crontab (crontab -e) the command follows the five fields. System crontabs such as /etc/crontab and files in /etc/cron.d add a user name field before the command.
Operators
| Operator | Meaning | Example | Runs |
|---|---|---|---|
* |
Every value | * * * * * |
Every minute |
, |
List | 0 9,17 * * * |
09:00 and 17:00 |
- |
Range | 0 9-17 * * * |
Every hour from 09:00 to 17:00 |
/ |
Step | */15 * * * * |
Minutes 0, 15, 30 and 45 |
a-b/n |
Step within a range | 0-30/10 * * * * |
Minutes 0, 10, 20 and 30 |
Operators combine: 0 8-10,14-16 * * 1-5 runs on the hour from 08:00 to 10:00 and from 14:00 to 16:00 on weekdays.
Steps restart every cycle
*/n means "values divisible by n", counted from the start of the field's range, not from when the job was added. In the minute field */45 runs at :00 and :45, then again at :00, so the gap alternates between 45 and 15 minutes. Steps only produce even intervals when they divide the range evenly: for minutes that's 1, 2, 3, 4, 5, 6, 10, 12, 15, 20 and 30.
Special strings
Most cron implementations (Vixie cron, cronie, Kubernetes) accept these shortcuts:
| String | Equivalent | Meaning |
|---|---|---|
@yearly / @annually |
0 0 1 1 * |
Midnight, 1 January |
@monthly |
0 0 1 * * |
Midnight on the 1st |
@weekly |
0 0 * * 0 |
Midnight on Sunday |
@daily / @midnight |
0 0 * * * |
Every day at midnight |
@hourly |
0 * * * * |
Every hour, on the hour |
@reboot |
(none) | Once, when the cron daemon starts |
GitHub Actions doesn't accept shortcuts, so use the five-field form there.
Common schedules
| Schedule | Expression |
|---|---|
| Every 5 minutes | */5 * * * * |
| Every 30 minutes | */30 * * * * |
| Every hour at minute 0 | 0 * * * * |
| Every day at midnight | 0 0 * * * |
| Every day at 02:30 | 30 2 * * * |
| Weekdays at 09:00 | 0 9 * * 1-5 |
| Every Sunday at 00:00 | 0 0 * * 0 |
| First day of the month | 0 0 1 * * |
| Every quarter (1 Jan, Apr, Jul, Oct) | 0 0 1 1,4,7,10 * |
Each of these has a detailed page with variations and pitfalls: every 5 minutes, every 30 minutes, every hour, every day at midnight, every Sunday and the first day of the month.
Day of month and day of week: OR, not AND
When both day fields are restricted, standard cron runs the job if either matches:
0 9 1-7 * 1 → 09:00 on days 1–7 of the month AND on every Monday
It doesn't mean "the first Monday of the month". To get that, restrict one field and test the other in the command (in a crontab, % must be escaped as \%):
0 9 1-7 * * [ "$(date +\%u)" = 1 ] && /usr/local/bin/report.sh
If either day field is *, only the other one applies, which is the normal case.
Time zones and daylight saving
Cron uses the time zone of the machine or service it runs on, which on servers and cloud schedulers is usually UTC. GitHub Actions always uses UTC.
Where local time is used, daylight saving changes cause surprises: a job scheduled at 02:30 may not run on the night clocks go forward, and may run twice when they go back. Prefer UTC for important jobs, or use a scheduler with explicit time zone support: CRON_TZ=Europe/Berlin at the top of a cronie crontab, or spec.timeZone in a Kubernetes CronJob.
Platform differences
| Platform | Fields | Notes |
|---|---|---|
| Linux crontab (cronie, Vixie) | 5 | Shortcuts supported; % in the command is a newline unless escaped |
| GitHub Actions | 5 | UTC only, minimum interval 5 minutes, no shortcuts |
| Kubernetes CronJob | 5 | Shortcuts supported; timeZone field since 1.27 |
Quartz, Spring @Scheduled |
6–7 | Seconds first, optional year; ?, L, W and # |
| AWS EventBridge | 6 | cron(0 9 ? * MON-FRI *): year field, ? required in one day field |
The six-field formats are the most common source of copy-paste errors. 0 0/5 * * * ? in Quartz means every 5 minutes; pasted into a crontab it's invalid.
Mistakes to avoid
* */1 * * *for "every hour". The*in the minute field makes it run every minute. Use0 * * * *.- Hour 24. Hours go from 0 to 23. Midnight is
0 0 * * *. - Overlapping runs. Cron starts a new run even if the previous one is still going. Wrap long jobs with
flock -n /tmp/job.lock command. - Missing environment. Cron runs with a minimal
PATHand no shell profile. Use absolute paths and set variables at the top of the crontab. - Lost output. Redirect output to a log (
>> /var/log/job.log 2>&1) or setMAILTO, or failures go unnoticed. - Everything at :00. Jobs scheduled exactly on the hour compete for shared resources. A minute like
17spreads the load.
Cron's timestamps and the run times it prints are easiest to check as Unix time; the timestamp guide covers converting between the two.