Cron expression to run every Sunday

Midnight at the start of Sunday, once a week. The shorthand @weekly is the same schedule.

0 0 * * 0

What it means

At 00:00, on Sunday.

Field-by-field breakdown
FieldValueMeaning

Next 5 runs

Upcoming run times
#Local timeUTCFrom now
Calculating the next run times…

Run times are shown in your device time zone and in UTC.

Open this in the builder

Field breakdown

Minute 0, hour 0, day of month *, month *, day of week 0. Cron accepts 0, 7 and SUN for Sunday, so 0 0 * * 0, 0 0 * * 7 and 0 0 * * SUN are three ways of writing the identical schedule.

The reason both 0 and 7 exist is convenience for ranges. Since the week is numbered Sunday-first, "Friday to Sunday" would otherwise have to be written 5,6,0; with 7 available you can write the more natural 5-7.

Midnight on Sunday is the start of Sunday, which is the moment right after Saturday evening ends. If you meant "after the week is over", you probably want Monday at 00:00 (0 0 * * 1) or Sunday night (0 23 * * 0).

Typical uses

  • Weekly full backups, with incrementals on the other six days.
  • Log compaction and archive rotation during the quietest hours of the week.
  • Database maintenance: reindexing, vacuuming, statistics refreshes.
  • Weekly digest emails — though those usually want a civilised hour, not 00:00.

Using it

# crontab, all equivalent
0 0 * * 0    /usr/local/bin/weekly-backup.sh
0 0 * * 7    /usr/local/bin/weekly-backup.sh
0 0 * * SUN  /usr/local/bin/weekly-backup.sh
@weekly      /usr/local/bin/weekly-backup.sh

The @weekly shorthand expands to 0 0 * * 0 exactly. It is convenient, but the explicit form documents itself better in a file someone else will read in two years.

Do not add a day-of-month restriction

Combining a weekday with a day of the month triggers cron's OR rule. 0 0 1 * 0 is not "the first Sunday of the month" — it is "the 1st of every month, plus every Sunday". Standard cron cannot express "first Sunday" at all. The workaround is a day-of-month range plus a guard:

0 0 1-7 * 0 /usr/local/bin/first-sunday.sh

That still fires on days 1 to 7 and every Sunday, because of the OR rule, so the reliable version tests inside the command:

0 0 1-7 * * [ "$(date +\%u)" = 7 ] && /usr/local/bin/first-sunday.sh

Here day-of-week is left as *, so only the day-of-month restriction applies, and the guard picks out the Sunday among days 1 to 7.

Variations

ExpressionRuns
0 0 * * 0Sunday at 00:00. Same as @weekly.
0 3 * * 0Sunday at 03:00 — deep in the quiet window.
0 0 * * 6Saturday at 00:00 instead.
0 0 * * 1Monday at 00:00 — start of the working week.
0 0 * * 0,3Twice a week, Sunday and Wednesday.
0 0 * * 6,0Both weekend days.

Related schedules

See all common schedules, or build a custom one in the generator.

Related tools