⚡
fasttools.me
Run Cron Job Every Sunday (0 0 * * 0)
Weekend Maintenance • Sunday Midnight

Run Cron Job Every Sunday (0 0 * * 0)

Schedule weekly jobs running every Sunday at midnight (0 0 * * 0). Visual field breakdown, next execution timetable, and maintenance scripts.

Direct Answer Definition

To run a cron job every Sunday at midnight in Linux, use the expression `0 0 * * 0`. The `0` in the fifth position represents Sunday. The cron macro `@weekly` is an exact shortcut for this schedule, firing once every week at Sunday 00:00.

POSIX Cron Expression (5-Field)
Valid Syntax
Natural Language Schedule

At midnight every Sunday

Standard Schedule PresetsClick to load

Interactive 5-Field Workbench

Adjust individual cron segments in real time with instant two-way synchronization.

1. Minute0
0 – 59
2. Hour0
0 – 23 (24h)
3. Day of Month*
1 – 31
4. Month*
1 – 12 (Jan – Dec)
Select Month
5. Day of Week0
0 – 6 (Sun – Sat)
Select Day

Next 5 Scheduled Executions

Real-time schedule timetable projected forward from current timestamp.

12026-10-10 18:00:00 UTC
in 2d 8h
22026-10-17 18:00:00 UTC
in 9d 8h
32026-10-24 18:00:00 UTC
in 16d 8h
42026-10-31 18:00:00 UTC
in 23d 8h
52026-11-07 18:00:00 UTC
in 30d 8h

Crontab Command Snippet

Enter your executable command or script path to generate the full crontab configuration line.

Ready to paste in `crontab -e`0 0 * * 0 curl -fsS https://example.com/cron-job
Runs in system timezone or explicit TZ variablePOSIX Spec
Advertisement
Sponsored Developer Space
Cron Field Syntax Mapping

Field-by-Field Breakdown of `0 0 * * 0`

PositionField NameAllowed ValuesValue in `0 0 * * 0`Evaluation Meaning
1Minute0 – 5900 (At minute 0)
2Hour0 – 2300 (At midnight / 00:00)
3Day of Month1 – 31** (Every day of the month)
4Month1 – 12** (Every month)
5Day of Week0 – 6 (Sun-Sat)00 (Sunday, also 7)
Technical Engineering Analysis

Weekend Maintenance Window Scheduling

Sunday midnight represents the international industry standard for scheduled maintenance windows. Web traffic on consumer applications and business SaaS platforms is typically at its weekly nadir, making it the safest time to perform heavy database vacuuming and system updates.

In cron syntax, Sunday is unique because it can be represented as both `0` and `7`. Both `0 0 * * 0` and `0 0 * * 7` are valid in Vixie Cron, though `0` is standard POSIX.

The special string `@weekly` expands to `0 0 * * 0`. When executing large migrations or vacuum commands during this window, always notify operations teams in advance.

Real-World Server Implementations

Common Production Scenarios for `0 0 * * 0`

Case 01

PostgreSQL Database Full Vacuum & Reindex

Reclaims dead tuple storage space and rebuilds B-tree database indices to prevent query plan degradation.

/usr/bin/vacuumdb --all --analyze --full
Case 02

Linux Server OS Security Package Updates

Applies non-breaking security updates and patches to Ubuntu/Debian packages during the weekly maintenance window.

/usr/bin/apt-get update && /usr/bin/apt-get upgrade -y
Case 03

Cold Storage S3 Glacier Archive Sync

Archives immutable database backups older than 30 days to deep cold storage tiers for cost optimization.

/usr/local/bin/sync-glacier.sh
Operational Traps & Failure Modes

Production Gotchas When Running `0 0 * * 0`

  • Saturday vs Sunday Confusion: Remember that `0 0 * * 0` fires at midnight as Saturday transitions into Sunday, NOT Sunday night into Monday.
  • Maintenance Overlap: If a full vacuum takes 4 hours, it may run into Sunday morning peak hours if scheduled too late.
  • Sunday 0 vs 7: While almost all systems treat 7 as Sunday, stick with `0` for 100% POSIX portability.

Frequently Asked Questions About `0 0 * * 0`

Is Sunday represented by 0 or 7 in cron?

Both are accepted in modern Linux cron implementations. Day 0 and Day 7 both resolve to Sunday. However, `0` is the standard POSIX convention.

Is `@weekly` the same as `0 0 * * 0`?

Yes, the `@weekly` macro is an exact alias for `0 0 * * 0`.

How do I schedule a Sunday job for Sunday night (11:00 PM)?

Set minute to `0` and hour to `23`: `0 23 * * 0 /path/to/script.sh`.

Related Cron Schedule Generators