Cron every Sunday at midnight

0 0 * * 0

0 0 * * 0 runs a job at 00:00 every Sunday. Minute and hour are 0, and the last field, the day of week, is 0 for Sunday. @weekly is a shortcut for exactly this line in most crons, and 0 0 * * 7 and 0 0 * * SUN mean the same.

When it fires

Checked at 09:58 UTC on Wednesday, October 14, the next five runs are:

Oct 18  Oct 25  Nov 1  Nov 8  Nov 15    (all at 00:00)

Which midnight?

The one that starts Sunday, straight after Saturday night. If “Sunday at midnight” means the end of the weekend, you want 23:59 on Sunday, 59 23 * * 0, or the midnight that starts Monday, 0 0 * * 1. A report on the week just ended, Monday to Sunday, only has all its data at 0 0 * * 1.

It’s also the server’s midnight. On a server in UTC the run starts on Saturday evening in the Americas; set CRON_TZ in the crontab, or the scheduler’s timezone, to pin it to a local Sunday.

Sunday’s number changes

Crontab counts Sunday as 0, and most crons take 7 too. AWS EventBridge and Quartz count from Sunday as 1, and EventBridge rejects 0, so cron(0 0 ? * 1 *) is Sunday there and cron(0 0 ? * 0 *) fails. systemd’s shortcut is the trap: its weekly means Monday at 00:00, not Sunday. Names avoid all of it: SUN means Sunday everywhere on this page.

The same schedule elsewhere

  • crontab: 0 0 * * 0 /usr/local/bin/weekly.sh, or @weekly /usr/local/bin/weekly.sh.
  • GitHub Actions: cron: '0 0 * * 0', at midnight UTC. GitHub doesn’t take @weekly.
  • Kubernetes CronJob: schedule: "0 0 * * 0", or "@weekly".
  • AWS EventBridge: cron(0 0 ? * SUN *).
  • systemd timer: OnCalendar=Sun 00:00, which systemd-analyze calendar normalizes to Sun *-*-* 00:00:00. Not weekly, which is Mon *-*-* 00:00:00.
  • Spring @Scheduled: 0 0 0 * * SUN, or @weekly.

Try it in the Cron Builder

At 00:00, only on Sunday

Read as a crontab line, where Sunday is 0 or 7.

minutehourday of monthmonthday of week
00**0

Next runs

Working out the next runs from your clock…

Runs in your browser. Nothing you enter is sent anywhere.