T
ToolPrime

Cron Expression for Every Sunday at Midnight

Run a cron job every Sunday at midnight using 0 0 * * 0. A classic weekly schedule for end-of-week maintenance and backups.

Expression

0 0 * * 0

At 00:00 every Sunday

Use Cases

Code Examples

Crontab

# At 00:00 every Sunday
0 0 * * 0 /path/to/your/script.sh

GitHub Actions

name: Scheduled Job
on:
  schedule:
    - cron: '0 0 * * 0'
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: echo "Running Every Sunday at Midnight"

systemd Timer

[Unit]
Description=Every Sunday at Midnight timer

[Timer]
OnCalendar=*-*-* *:*:00
Persistent=true

[Install]
WantedBy=timers.target

Tips

Frequently Asked Questions

Is Sunday 0 or 7 in cron?

Both. In most cron implementations, Sunday can be represented as either 0 or 7. The POSIX standard uses 0, but many implementations accept both.

What is the difference between @weekly and 0 0 * * 0?

They are equivalent. @weekly is a shorthand for 0 0 * * 0, meaning every Sunday at midnight.

Related Cron Expressions