Cron expression
A cron expression is a compact schedule of five space-separated fields (minute, hour, day of month, month and day of week) that tells the cron daemon, and many schedulers modeled on it, when to run a job. Different systems add fields or change the rules, so the same text can mean different things.
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)
│ │ │ │ │
* * * * *
The cron daemon wakes every minute and runs each job whose fields all match the current time. 30 9 * * 1-5 means minute 30, hour 9, any day of the month, any month, Monday through Friday: 09:30 on weekdays.
Each field accepts a few building blocks:
| Syntax | Meaning | Example |
|---|---|---|
* | Every value | * * * * * runs every minute |
a,b | A list | 0,30 is minutes 0 and 30 |
a-b | An inclusive range | 9-17 is hours 9 to 17 |
*/n or a-b/n | A step | */15 is every 15 minutes |
Most implementations also accept @daily, @hourly, @weekly, @monthly and @yearly as shortcuts.
Two rules that surprise people
- Day of month and day of week combine with OR. When both fields are restricted, cron runs a job when either matches.
0 0 13 * 5runs on the 13th of every month and on every Friday, not just on Friday the 13th. It is an AND only when one of the two fields is*. - Steps restart each cycle.
*/7 * * * *fires at minutes 0, 7, 14 … 56 and then at 0 again, so the gap after minute 56 is only 4 minutes. A step never carries over from one hour to the next.
Dialects
Standard five-field cron is used by crontab, Kubernetes CronJobs and GitHub Actions schedules. Other systems borrow the idea but change it. Quartz and Spring put a seconds field first and use ?, L, W and #. AWS EventBridge uses six fields ending in a year. Both number the days of the week from Sunday = 1 instead of 0. An expression copied between these systems can run at the wrong time without any error.
Common pitfalls
- Time zones. Cron uses the time zone of the machine running it, and containers and cloud schedulers are commonly UTC.
- Percent signs. In a crontab command, an unescaped
%is treated as a newline, so write\%. - No catch-up. If the machine is off at the scheduled minute, plain cron skips the run.
- Minimal environment. Jobs run with a short
PATHand no shell profile, so commands that work in your terminal can fail under cron.
Related terms
- Unix timestamp — A Unix timestamp is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970, the Unix epoch. It is a single number that identifies a moment in time regardless of time zone, which makes it easy to store, sort and compare.
- ISO 8601 timestamp — ISO 8601 is the international standard for writing dates and times unambiguously, and RFC 3339 is the strict internet profile of it, such as 2026-09-18T14:30:00Z. Both put the largest unit first, so the text sorts in chronological order.
References
Ads on this page
Non-personalized ads help keep Vaultools free — Google decides where they appear on the page.
Go Pro to remove them →