Skip to main content
Tools Harbor

Cron expression for every Sunday

The cron expression 0 0 * * 0 runs a job every Sunday at midnight in Unix cron. The trailing 0 is the day-of-week — Sunday in Vixie cron’s 0-based numbering. AWS EventBridge uses 1-based numbering where Sunday is 1, so the equivalent is cron(0 0 ? * 1 *) or, more readably, cron(0 0 ? * SUN *). Sunday weekly schedules are typical for backup, archive and report jobs.

Quick reference

PlatformExpressionSunday number
Unix / Linux crontab0 0 * * 0 or @weekly0 (also 7)
Kubernetes CronJob0 0 * * 0 or @weekly0
GitHub Actions0 0 * * 00
AWS EventBridgecron(0 0 ? * SUN *) or cron(0 0 ? * 1 *)1 (named: SUN)
Quartz (Java)0 0 0 ? * SUN1 (named: SUN)

Why does Sunday have multiple numbers?

Unix System V cron numbered days 0–6 starting Sunday, matching the C library’s tm_wday field. Vixie cron (the dominant Linux cron implementation) extended that to also accept 7 as Sunday, for compatibility with people coming from systems that used 1–7 numbering.

So in Vixie cron, all three of these are equivalent:

0 0 * * 0      # Sunday (Unix convention)
0 0 * * 7      # Sunday (Vixie compat with 1-7 systems)
0 0 * * SUN    # Sunday (named, unambiguous)

AWS EventBridge and Quartz inherit from Java’s Calendar class, which numbers days 1–7 starting Sunday. So in AWS, 0 is invalid (out of range), 1 is Sunday, 2 is Monday, and so on.

The portable form across all schedulers is the named day: SUN, MON, TUE, WED, THU, FRI, SAT. Use it when you’re writing IaC that might target multiple platforms.

Variations

ScheduleExpression
Every Sunday at midnight0 0 * * 0
Every Sunday at 2 AM (typical maintenance window)0 2 * * 0
Sunday morning at 6 AM0 6 * * 0
Every Sunday afternoon at 3 PM0 15 * * 0
Every Sunday in AWS (named form)cron(0 0 ? * SUN *)
Every Saturday and Sunday (weekend)0 0 * * 0,6

How do I use it on each platform?

Linux crontab:

0 0 * * 0 /usr/local/bin/weekly-backup

Or with the shortcut:

@weekly /usr/local/bin/weekly-backup

Kubernetes CronJob:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: weekly-backup
spec:
  schedule: "0 2 * * 0"           # Sunday 2 AM — typical maintenance window
  timeZone: "America/New_York"
  successfulJobsHistoryLimit: 5    # keep more history for weekly jobs
  jobTemplate:
    spec:
      activeDeadlineSeconds: 7200  # backup may take up to 2 hours
      template:
        spec:
          containers:
            - name: backup
              image: my-org/backup:1.0
          restartPolicy: OnFailure

AWS EventBridge Scheduler:

Type: AWS::Scheduler::Schedule
Properties:
  Name: weekly-backup
  ScheduleExpression: 'cron(0 2 ? * SUN *)'
  ScheduleExpressionTimezone: 'America/New_York'
  FlexibleTimeWindow:
    Mode: 'OFF'
  Target:
    Arn: !GetAtt BackupFunction.Arn
    RoleArn: !GetAtt SchedulerRole.Arn

GitHub Actions:

on:
  schedule:
    - cron: '0 2 * * 0'      # 2 AM UTC every Sunday

Common mistakes

Using 0 for Sunday in AWS. AWS rejects 0 for day-of-week — its valid range is 1–7. Use 1 or, better, the named form SUN.

Forgetting ? in AWS for day-of-month. AWS doesn’t allow both dom and dow as *. cron(0 0 * * SUN *) is rejected; cron(0 0 ? * SUN *) is the valid form.

Assuming * * * * 1 means “every Sunday”. It means “every Monday” — Vixie counts from Sunday (0) so Monday is 1. To say Sunday explicitly, use 0, 7, or SUN.

For other schedules see common cron schedules, or build a custom expression with the Cron Expression Builder.

Frequently asked questions

Why is Sunday `0` in Unix and `1` in AWS?
Historical accident. Unix System V cron defined day-of-week as 0–6 with Sunday=0 (matching the C library convention). Vixie cron, the most common Linux cron today, kept that but also accepts `7` as Sunday. AWS EventBridge and Quartz adopted Java's 1-based day numbering (Calendar.SUNDAY = 1), so Sunday is `1` and Saturday is `7`. Use named days (`SUN`, `MON`, …) when porting between them.
What is `@weekly` and is it the same as `0 0 * * 0`?
`@weekly` is a Vixie-cron alias for `0 0 * * 0` — midnight on Sunday. Accepted in Linux crontab, GitHub Actions, anacron and Kubernetes CronJob. NOT accepted in AWS EventBridge. The week starts on Sunday by Vixie convention; if you want Monday-based weeks, use `0 0 * * 1` explicitly.
How do I run a job every Sunday in AWS EventBridge?
Either `cron(0 0 ? * SUN *)` (named, recommended) or `cron(0 0 ? * 1 *)` (numeric). Don't use `0` — AWS rejects it as out of range. The `?` for day-of-month is mandatory because AWS forbids both dom and dow being `*` at once.

Need a different schedule?

Build cron expressions for Unix, Kubernetes and AWS — with a human-readable description and the next 5 run times.

Open the Cron Expression Builder →

Related