Crontab Every Weekend at Midnight (0 0 * * 6,0)

Schedule a cron job to run at midnight on Saturday and Sunday. Use comma-separated day-of-week values for weekend-only schedules.

Weekly0 0 * * 6,0

Detailed Explanation

Running a Cron Job on Weekends

The expression 0 0 * * 6,0 runs at midnight on Saturday (6) and Sunday (0). The comma-separated values in the day-of-week field select specific days.

Field Breakdown

Field Value Meaning
Minute 0 At minute 0
Hour 0 At midnight
Day of Month * Any day
Month * Every month
Day of Week 6,0 Saturday and Sunday

Weekend vs. Weekday Day-of-Week Values

Schedule Expression Days
Weekdays 1-5 Monday through Friday
Weekends 6,0 Saturday and Sunday
Every day * (or 0-6) All seven days

Alternative Weekend Syntax

Some cron implementations accept 0,6 or 6,0 interchangeably, or even SAT,SUN as named values. For maximum portability, stick with numeric values.

Weekend Maintenance Windows

Weekends are often used for heavy maintenance because they have less user traffic:

# Full database backup (Saturday 2 AM)
0 2 * * 6 /scripts/full-backup.sh

# Database optimization (Sunday 3 AM)
0 3 * * 0 /scripts/optimize-db.sh

# System updates (Saturday midnight)
0 0 * * 6 /scripts/system-update.sh

Use Case

Weekend scheduling is ideal for heavy maintenance tasks that require downtime or significant resources: full database backups, index rebuilding, system updates and patching, data migration jobs, load testing, and batch processing that would impact weekday performance.

Try It — Crontab Cheat Sheet

Open full tool