The expression
0 0 1 1,4,7,10 *
Runs at midnight on the first day of each calendar quarter: 1 January, 1 April, 1 July and 1 October. Four runs a year.
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 |
at minute 0 |
| Hour | 0 |
at midnight |
| Day of month | 1 |
the 1st |
| Month | 1,4,7,10 |
January, April, July, October |
| Day of week | * |
any day of the week |
The same schedule can be written with a step: 0 0 1 */3 *. Months are numbered 1 to 12, so */3 starts at 1 and gives 1, 4, 7, 10. Month names work too: 0 0 1 JAN,APR,JUL,OCT *. The explicit list is easier to read and to shift.
Variants
| Schedule | Expression |
|---|---|
| Start of each quarter at 6am | 0 6 1 1,4,7,10 * |
| Fiscal quarters starting in February | 0 0 1 2,5,8,11 * |
| A week into each quarter (the 8th) | 0 0 8 1,4,7,10 * |
| Last day of each quarter | 0 0 28-31 3,6,9,12 * plus a test |
| Twice a year (1 January and 1 July) | 0 0 1 1,7 * |
| Every month | 0 0 1 * * |
| Once a year | 0 0 1 1 * |
For the last day of a quarter, schedule the 28th-31st of March, June, September and December and let the command check that tomorrow is the 1st: [ "$(date -d tomorrow +\%d)" = 01 ] && command (escape % as \% in crontab). The last day of the month page explains the test; on AWS it's cron(0 0 L 3,6,9,12 ? *).
Watch the step form with other start months: */3 always starts at January. For quarters beginning in February write 2-12/3 or the list.
Where to write it
- crontab (Linux, macOS):
0 0 1 1,4,7,10 * commandincrontab -e, in the server's time zone. If the machine might be off on that day, use anacron or a systemd timer withPersistent=trueso the run isn't lost for three months. - GitHub Actions:
cron: '0 0 1 1,4,7,10 *'in UTC. In a public repository GitHub disables scheduled workflows after 60 days without repository activity, so a quarterly workflow in a quiet repo will be switched off before its second run. Commit regularly, or use another scheduler. - Kubernetes CronJob:
schedule: "0 0 1 1,4,7,10 *"withtimeZone:. - AWS EventBridge:
cron(0 0 1 1,4,7,10 ? *)orcron(0 0 1 1/3 ? *), with?in day of week.
Common mistakes
0 0 1 */4 *is every four months (January, May, September), not quarterly.0 0 * 1,4,7,10 *runs every day of those four months.- Never testing it. A quarterly job runs for the first time months after it's written. Run the command by hand once, and check the schedule's next dates.
Check the next four runs in the Cron Expression Parser.