⚡
Ultimate Design Tools
/Guides
ToolsGuidesAbout
CodeApr 15, 2026 · Updated Oct 13, 2026·4 min read

Complete Guide to Cron Expressions & Scheduling

Cron is the time-based job scheduler that powers automation across Unix, Linux, macOS, cloud platforms, and CI/CD pipelines. If you have ever needed to run a script at midnight, send a report every Monday, or clean up logs every hour, you have used cron.

1. Anatomy of a Cron Expression

A standard cron expression has five fields separated by spaces: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-6, where 0 is Sunday). Each field can be a specific value, a range, a list, a step, or a wildcard.

The five fields answer the question: at what minute, of what hour, on what day of the month, in what month, on what day of the week should this job run?

2. Special Characters

3. Common Cron Schedules

4. Common Gotchas

Day-of-month AND day-of-week

When both day-of-month and day-of-week are set to non-* values, most cron implementations use OR logic — the job runs when either condition is met. This catches many people off guard. 0 0 15 * 5 means midnight on the 15th OR every Friday, not the 15th only if it is Friday.

Environment variables

Cron jobs run with a minimal environment — your PATH, HOME, and other variables may not be set. Always use absolute paths in cron scripts and source your profile if needed.

Pro tip: Redirect output to a log file to debug issues: */5 * * * * /path/to/script.sh >> /var/log/myjob.log 2>&1

Percent signs end the command

In a crontab line, an unescaped % is turned into a newline and everything after the first one is sent to the command as standard input (crontab(5)). So 0 1 * * * tar czf /backup/$(date +%F).tgz /srv silently breaks. Escape it as \%F, or move the command into a script.

Daylight-saving changes

Debian's cron(8) documents what happens when the clock jumps by less than three hours: jobs whose time was skipped in the spring run soon after the change, and jobs in the repeated hour in the autumn are not run twice; wildcard jobs simply follow the new time. Our test below shows the spring case: on March 8, 2026 in New York, a 02:30 daily job fires at 03:00 EDT, the moment the clock jumps. If a job must not run twice or late, schedule it outside 01:00–03:00 local time or run the server in UTC.

4b. Worked Example: The Guide's Expressions, Checked

We ran the expressions from this guide through the cron engine behind our Crontab Explainer and through croniter 6.2.4 (Python), from March 6, 2026, America/New_York. Both gave identical times (script and results in our test folder, October 13, 2026):

ExpressionNext runs (local time)What it shows
0 0 15 * 5Fri Mar 6, Fri Mar 13, Sun Mar 15, Fri Mar 20, Fri Mar 27Day-of-month and day-of-week are ORed: every Friday plus the 15th
0 9 * * 1-5Fri Mar 6, Mon Mar 9 … Fri Mar 13, Mon Mar 16Weekend skipped; 09:00 stays 09:00 across the DST change (14:00 → 13:00 UTC)
30 2 * * *02:30 Mar 6–7, 03:00 Mar 8, 02:30 Mar 9 onwardThe skipped 02:30 runs at the jump

4c. Same Five Fields, Different Rules

"Cron syntax" means slightly different things on each platform. Before copying an expression between them, check these differences (from each platform's documentation, checked October 13, 2026):

PlatformFieldsTime zoneNotable rules
Vixie cron / cronie (Linux)5System local time0 and 7 both mean Sunday; DOM/DOW ORed; % is special
GitHub Actions schedule5 (POSIX)UTC by default; an IANA timezone can be setShortest interval every 5 minutes; runs on the latest commit of the default branch; with a DST zone, runs in a skipped hour move to the next valid time
AWS EventBridge Scheduler6, wrapped as cron(...)Set per scheduleAdds a year field; day-of-week is 1–7 starting with Sunday = 1; supports L, W, # and ? wildcards
Kubernetes CronJob5.spec.timeZone, else the controller's local zoneCRON_TZ/TZ inside the schedule is not supported

The day-of-week trap is the costly one: 0 9 * * 1 is Monday in Linux cron and GitHub Actions, but in AWS's six-field format Monday is 2.

5. Cron Best Practices

Test Your Cron Expression

Free. No signup. Runs 100% in your browser.

Open Crontab Explainer →
✍️
Derek Giordano
Founder, Ultimate Design Tools
🔗 Related Tools & Guides