Monthly and yearly schedules
| Schedule | Expression |
|---|---|
| 1st of every month at 00:00 | 0 0 1 * * |
| 1st of every month at 06:30 | 30 6 1 * * |
| 15th of every month at 12:00 | 0 12 15 * * |
| 1st and 15th of every month | 0 0 1,15 * * |
| Quarterly: 1 Jan, Apr, Jul and Oct | 0 0 1 1,4,7,10 * |
| Yearly on 1 January | 0 0 1 1 * |
The last day of the month
Standard cron has no "last day" value. Schedule the job on days 28 to 31 and let it run only when tomorrow is the 1st (this uses GNU date, as on most Linux systems; % is escaped in crontab):
0 23 28-31 * * [ "$(date -d tomorrow +\%d)" = "01" ] && /usr/local/bin/close-month.shQuartz and Spring have L
Schedulers with Quartz-style expressions support L for the last day: 0 0 0 L * ? in Quartz. They also add a seconds field, so the fields don't line up with standard cron. Paste only five-field expressions into the tool above.
Frequently asked questions
What happens to a job scheduled on the 31st in a shorter month?
It doesn't run that month. 0 0 31 * * runs only in the seven months that have 31 days. Use the last-day check above instead.
Is @monthly the same as 0 0 1 * *?
Yes, in Vixie cron, cronie and Kubernetes. GitHub Actions doesn't accept shortcuts, so use 0 0 1 * * there.
Why should a monthly report run on the 1st instead of the last day?
On the 1st, the previous month is complete, so a report for it can include every record. Just make sure the job uses last month's dates.