Cron expression for once a year

0 0 1 1 *

The job runs once a year, at 00:00 on 1 January. Many crons also accept @yearly or @annually.

Runs when: minute 0; hour 0; day of month 1; in Jan; any day of week.

Change it in the cron expression generator

How the five fields read

FieldValueReads as
Minute0at 0
Hour0at 0
Day of month1at 1
Month1at January
Day of week*every value

The next five runs

What people use it for

Nobody notices when it breaks

A job that runs once a year gets forgotten, and by the next January the server it lived on may have been replaced. Run it by hand once from the command line before you trust it, move it along when you migrate, and put a calendar reminder next to it. A date such as 29 February (0 0 29 2 *) only occurs in leap years and will not fire at all in the others.

Variations of once a year

ExpressionWhat it does
0 9 1 1 *1 January at 09:00 instead of midnight.
0 0 31 12 *31 December at midnight.
0 0 1 7 *1 July at midnight, for a fiscal year that starts in July.

The same schedule in four tools

Linux crontab

0 0 1 1 * /path/to/command

Add it with crontab -e. It runs in the machine's time zone.

Kubernetes CronJob

spec:
  schedule: "0 0 1 1 *"
  timeZone: "Etc/UTC"
  concurrencyPolicy: Forbid

timeZone is stable from Kubernetes 1.27. Without it, the controller's time zone applies. Forbid stops a new run starting while the last one is still going.

GitHub Actions

on:
  schedule:
    - cron: '0 0 1 1 *'

Schedules run in UTC from the default branch, and a run can start a few minutes late when GitHub is busy. Scheduled workflows in public repositories are disabled after 60 days without repository activity.

AWS EventBridge

cron(0 0 1 1 ? *)

EventBridge uses six fields, with a question mark in one of the two day fields, and rules run in UTC. Weekday numbers start at Sunday = 1, so names such as MON are safer than numbers.

Questions about once a year

Is @yearly the same as @annually?
Yes, both mean 0 0 1 1 * in Vixie cron.
How do I make sure a once-a-year job really fires?
Check the dates in the next-run list, run the command by hand once, and add a heartbeat check that alerts you if it never reports in. A job that runs once a year gets almost no real-world testing.

Nearby schedules

Scheduling jobs, pipelines and cloud infrastructure is part of my DevOps engineering work.