Cron Expression for Once a Year
The cron expression for once a year is 0 0 1 1 *, which runs at 00:00 on 1 January. @yearly and @annually are both shorthand for it.
At 12:00am on day 1 of the month in January.
0 0 1 1 *Standard 5-field crontab syntax. Day of month and day of week are OR'd when both are set.
What it does
Both date fields are restricted here: day of month 1 and month 1 (January). With the time at 0 0 and the day of week left open, the only minute of the year that matches is the first one. To choose a different date, change the two numbers — 0 9 1 4 * runs at 09:00 on 1 April.
Yearly jobs are rare but important: deleting data under a retention policy, rolling over a financial year, renewing long-lived certificates or domains, sending annual summaries or tax documents, or resetting year-to-date counters. Because they run so seldom they're easy to forget — and a broken one can go unnoticed for a whole year.
That makes yearly jobs worth extra care. Test the command by running it by hand, log every run, and don't rely on the server being up at exactly 00:00 on 1 January: a machine that's rebooting or being migrated at that minute skips the run until next year. anacron, or a systemd timer with Persistent=true, runs a missed job once the machine is back.
New Year's Day is also a public holiday almost everywhere, when fewer people are watching dashboards and many teams freeze changes. If the job only needs to happen once a year, not specifically on 1 January, pick a quiet working day instead — 0 10 15 1 * runs at 10:00 on 15 January, when someone will be around to check it worked.
How 0 0 1 1 * works, field by field
| FIELD | VALUE | MEANING |
|---|---|---|
| Minute | 0 | minute 0 |
| Hour | 0 | hour 0 (midnight) |
| Day of month | 1 | day 1 of the month |
| Month | 1 | January |
| Day of week | * | every day of the week |
Put together, cron reads 0 0 1 1 * as: “At 12:00am on day 1 of the month in January.”
To see further ahead, paste the expression into the cron calculator, which lists the next ten run times and counts how many times the schedule runs in a year.
Frequently asked questions
What's the difference between @yearly and @annually?
None. Both are shorthand for 0 0 1 1 *, midnight on 1 January, and both are accepted by Vixie cron and cronie.
How do I run a cron job once a year on a specific date?
Put the day in the third field and the month in the fourth: 30 8 15 6 * runs at 08:30 on 15 June every year.
Can cron run a job every two years?
Not directly — standard cron has no year field. Run the job yearly and let the command skip odd or even years, for example by checking date +%Y.