Skip to content
Cron schedules

Cron job every year: expression and example

The cron expression for on 1 January at midnight is 0 0 1 1 *. Put it at the start of a crontab line, followed by the command. Below: what each of the five fields does, a sample line you can copy, the mistakes people make with this schedule, and how to get told when the job doesn't run.

The expression

A cron expression has five fields separated by spaces: minute, hour, day of month, month, day of week. An asterisk means "every"; a number means "only this one"; */n means "every nth"; a-b is a range and a,b is a list. For on 1 January at midnight the fields are:

FieldValueMeaning
Minute (0-59)0minute 0
Hour (0-23)0hour 0
Day of month (1-31)1day 1 of the month
Month (1-12)1month 1: January
Day of week (0-7, Sunday is 0 or 7)*every day of the week

Example crontab line

Open the crontab with crontab -e and add one line: the expression, a space, then the command exactly as you'd type it in a shell. Annual archive jobs, resetting yearly counters, generating year-end reports. A typical line looks like this:

0 0 1 1 * /srv/app/bin/year-end-archive >> /var/log/archive.log 2>&1

The >> file 2>&1 at the end sends both normal output and errors to a log file. Without it, cron tries to email the output to the user, which usually means it's lost.

Gotchas

  • If the server is off or being rebuilt at midnight on 1 January, the run is skipped; cron doesn't catch up. Make the job safe to run by hand afterwards.
  • Timezone again: midnight 1 January UTC is still 31 December in the Americas.
  • @yearly and @annually are shorthands for this expression.
  • Timezone: cron uses the server's system timezone, which on most cloud servers is UTC. Run date on the server to see what "now" means to cron.
  • Environment: cron runs with a minimal PATH and no shell profile. Use full paths (/usr/bin/python3, not python3) and set any variables at the top of the crontab.
  • Output: if a job prints anything and there's no redirect or MAILTO, cron tries to send mail. Set [email protected] at the top of the crontab or redirect output to a log.
  • Silence: cron does not tell you when a job fails or never starts. A job that errors every run looks exactly like a job that runs fine, unless something is watching for it.

Know when it didn't run

In short: Append && curl -fsS https://heyuptime.com/ping/<token> to the line, create a heartbeat monitor with a 1 week period and 1 hour grace, and you're alerted when the job is late.

A heartbeat monitor in heyUptime is a URL your job calls when it finishes. Because of the &&, the ping is only sent when the command exits successfully, so a crashing job and a job that never started look the same: no ping. The watched line for this schedule is 0 0 1 1 * /srv/app/bin/year-end-archive && curl -fsS https://heyuptime.com/ping/<token>.

Set the heartbeat's period to 1 week and the grace to 1 hour. If a ping doesn't arrive within period plus grace, you get an alert by email, Slack, Discord, Teams or Telegram that says when the job was last seen. A yearly job is beyond any heartbeat period (heyUptime's longest is a week). The practical answer is a daily or weekly wrapper that exits early except on 1 January and pings on every successful exit, so you know the schedule is alive all year and the real run is a normal day for the heartbeat.

To try it before signing up, the free cron job tester gives you a temporary URL for 24 hours; add it to the line and watch the ping arrive.

Questions

What is the cron expression for once a year?

0 0 1 1 *: midnight on 1 January. @yearly means the same.

What if the server is down when the yearly job is due?

Standard cron skips it. anacron (on systems that have it) catches up missed daily, weekly and monthly jobs, but has no yearly schedule, so make the job safe to run by hand and check it on 2 January.

How do I monitor a yearly job?

Wrap it in a daily or weekly cron that exits early except on the right date and pings a heartbeat on success. The heartbeat then tells you if the wrapper ever stops, which is the failure you'd otherwise discover a year late.

Watch this job for free.

Create a heartbeat with a 1 week period, add one curl to the crontab line, and get told the first time it doesn't run. 14-day trial, no card.

Watch this job free

Updated October 8, 2026.