- Home
- Tools
- Developer Tools
- Cron Expression Explainer
- Cron Expression for Once a Year
Cron Expression for Once a Year
0 0 1 1 * runs a job once a year, at 00:00 on 1 January, the same as @yearly. Change the day and the month below to pick another date.
At 00:00 on the 1st of January
| Field | Value | Matches |
|---|---|---|
| Minute | 0 | 0 |
| Hour | 0 | 0 |
| Day of month | 1 | the 1st |
| Month | 1 | January |
| Day of week | * | every day of the week |
Next 10 runs
Cron goes by the clock of the machine it runs on. These are the runs on a machine in your time zone.
One run a year
0 0 1 1 * reads as minute 0, hour 0, day 1, month 1: at 00:00 on 1 January. @yearly and @annually are shortcuts for it. For another date, change the third and fourth field. Month names are allowed, so Christmas Day can be written as 0 0 25 12 * or as 0 0 25 DEC *.
| Expression | Runs |
|---|---|
| 0 0 1 1 * | At 00:00 on the 1st of January |
| @yearly | At 00:00 on the 1st of January |
| 0 0 25 12 * | At 00:00 on the 25th of December |
| 0 0 1 12 * | At 00:00 on the 1st of December |
| 0 0 12 1 * | At 00:00 on the 12th of January |
| 0 0 29 2 * | At 00:00 on the 29th of February |
Day first, then month
The day of the month comes before the month, whatever order dates have where you live. 0 0 1 12 * is 1 December and 0 0 12 1 * is 12 January. With a date like that the mistake goes unnoticed for months.
29 February
0 0 29 2 * is a valid schedule that runs only in leap years. The list of next runs shows it: there are four years between them.
A job nobody watches
A yearly job has had a year in which a path, a password or a server name could change, and cron will not tell you that it failed unless mail is set up for it. If the machine happens to be off at that minute, the run is lost, because cron does not catch up. Run the command by hand once in a while.
The cron expression explainer has the full syntax: the five fields, lists, ranges and steps, and how day of month and day of week work together.