Cron schedule
Cron every Sunday
The cron expression for every Sunday is 0 0 * * 0: 00:00 at the start of Sunday. In cronie, Debian cron, node-cron and Spring, 0 0 * * 7 and 0 0 * * SUN mean the same.
| Expression | 0 0 * * 0 |
|---|---|
| Runs | 52 times in 2027 |
| systemd OnCalendar | Sun *-*-* 00:00:00 |
How it works
Sunday has two numbers in standard cron. crontab(5) documents the day-of-week range as 0-7, with both 0 and 7 as Sunday. Kubernetes and Vercel document 0-6 only, so 0 is the one every implementation accepts.
This is the schedule behind @weekly, which crontab(5) and the Kubernetes docs both define as 0 0 * * 0. The every-week page covers the macro; this page is about the day itself.
00:00 on Sunday is Saturday night turning into Sunday. People who say “Sunday night” usually mean the end of Sunday, which in cron is 0 0 * * 1 (the midnight that starts Monday) or 59 23 * * 0.
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | minute 0 (on the hour) |
| Hour | 0 | hour 0 (12 AM) |
| Day of month | * | every day of the month |
| Month | * | every month |
| Day of week | 0 | Sunday |
Next runs
As on GitHub Actions without timezone, Vercel, Cloudflare and Kubernetes with timeZone "Etc/UTC".
| Run | Your time | UTC |
|---|---|---|
| 1 | Calculating… | |
| 2 | ||
| 3 | ||
| 4 | ||
| 5 |
Ready-to-paste versions
The same schedule for each scheduler, with what differs on each one.
crontab (Linux, macOS, BSD)
# m h dom mon dow command
0 0 * * 0 /usr/local/bin/job.sh >> /var/log/job.log 2>&1- cron uses the server’s time zone. On cronie (Fedora, RHEL), a
CRON_TZ=Europe/Londonline above the entry changes the zone for the entries below it.
GitHub Actions
on:
schedule:
- cron: '0 0 * * 0'
# timezone: 'America/New_York' # optional; UTC when omitted
workflow_dispatch: {}- Runs in UTC unless you set
timezone, and only on the default branch. GitHub’s docs warn that scheduled runs can be delayed at busy times and that schedules in public repositories are disabled after 60 days without activity. - The start of every hour is GitHub’s busiest slot. If the exact minute doesn’t matter, move the
0to something like17to get picked up sooner. - With a
timezonethat observes DST, a time skipped by the spring-forward change advances to the next valid time (the docs’ example: 2:30 AM becomes 3:00 AM).
Kubernetes CronJob
apiVersion: batch/v1
kind: CronJob
metadata:
name: scheduled-job
spec:
schedule: "0 0 * * 0"
timeZone: "Etc/UTC"
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: job
image: busybox:1.36
command: ["/bin/sh", "-c", "date; echo running"]spec.timeZoneis stable since Kubernetes 1.27; without it, the kube-controller-manager’s zone applies.concurrencyPolicy: Forbidskips a run while the previous Job is still active.
Vercel Cron Jobs
{
"crons": [
{ "path": "/api/cron", "schedule": "0 0 * * 0" }
]
}- Vercel always uses UTC, doesn’t accept names like
MONorJAN, and won’t let you set both day of month and day of week. - This fits the Hobby plan, but Hobby precision is per hour: the invocation can land anywhere within the scheduled hour.
Cloudflare Workers
[triggers]
crons = ["0 0 * * SUN"]- Cron Triggers run on UTC. Changes can take up to 15 minutes to propagate across Cloudflare’s network.
- Cloudflare numbers weekdays 1 = Sunday to 7 = Saturday, unlike standard cron, so the example uses names (
MON,SUN), which are unambiguous.
node-cron (Node.js)
import cron from 'node-cron';
// 6 fields: the first one (seconds) is optional
cron.schedule('0 0 0 * * 0', async () => {
await runJob();
}, { timezone: 'UTC', noOverlap: true });- The schedule lives inside the Node process: if it’s down, nothing runs, and three replicas run the job three times.
noOverlapskips a tick while the previous run is still going.
systemd timer
# /etc/systemd/system/job.timer
[Unit]
Description=Run job.service every Sunday at midnight
[Timer]
OnCalendar=Sun *-*-* 00:00:00
Persistent=true
[Install]
WantedBy=timers.target
# /etc/systemd/system/job.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/job.sh
# systemctl daemon-reload && systemctl enable --now job.timer- Check it with
systemd-analyze calendar 'Sun *-*-* 00:00:00', which prints the normalized form and the next elapse.AccuracySecdefaults to 1min, so the start can drift by up to a minute. Persistent=trueruns the job at boot if the machine was off at the scheduled time, which plain cron doesn’t do.
Spring @Scheduled and Quartz
@Scheduled(cron = "0 0 0 * * 0", zone = "UTC")
public void runJob() {
// ...
}
// Quartz CronTrigger:
CronScheduleBuilder.cronSchedule("0 0 0 ? * SUN")- In Spring, the first of the 6 fields is seconds; the rest follow standard cron (0 or 7 = Sunday).
- In Quartz, one of the two day fields must be
?, and weekdays run 1 = Sunday to 7 = Saturday, which is why the example uses names.
Pitfalls
7 isn’t accepted everywhere
Kubernetes and Vercel document day of week as 0-6, and on Cloudflare 7 means Saturday. 0 is the portable number, and SUN is clearer where names are allowed (not on Vercel).
Quartz and Cloudflare count Sunday as 1
In Quartz and Cloudflare Cron Triggers, 0 0 * * 1-style numbering starts with 1 = Sunday. Copying a standard 0 or 7 across gives an error or the wrong day. Use SUN.
“Sunday midnight” is ambiguous
Some people mean the midnight at the start of Sunday, others the one at the end. Pick the expression that matches, and write the intended local time in a comment next to it.
Frequently asked questions
- What is the cron expression for every Sunday?
- 0 0 * * 0 runs at midnight every Sunday. 0 0 * * SUN is equivalent where names are supported.
- Is Sunday 0 or 7 in cron?
- Both, in cronie, Debian cron, node-cron and Spring. 0 is accepted everywhere, including Kubernetes and Vercel, which document 0-6.
- How do I run a cron job every Sunday at 2 AM?
- 0 2 * * 0. If the server uses a zone with DST, 2 AM is inside the window that DST can skip or repeat; 3 or 4 AM is safer.
- How do I run every Sunday night at 11 PM?
- 0 23 * * 0 runs at 23:00 on Sunday.
Last reviewed by Arielton Oberek.