Cron Expression for Every Weekend (Sat-Sun)
Run a cron job every Saturday and Sunday at midnight using 0 0 * * 0,6. Ideal for weekend maintenance and off-peak processing.
Expression
0 0 * * 0,6 At 00:00 on Saturday and Sunday
Use Cases
- • Running heavy maintenance during low-traffic weekends
- • Processing large data migrations off-peak
- • Generating weekend-specific analytics
- • Running extended security scans without user impact
Code Examples
Crontab
# At 00:00 on Saturday and Sunday
0 0 * * 0,6 /path/to/your/script.sh GitHub Actions
name: Scheduled Job
on:
schedule:
- cron: '0 0 * * 0,6'
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Running Every Weekend" systemd Timer
[Unit]
Description=Every Weekend timer
[Timer]
OnCalendar=*-*-* *:*:00
Persistent=true
[Install]
WantedBy=timers.target Tips
- ✓ 0 = Sunday and 6 = Saturday in cron
- ✓ Weekend runs avoid impacting business-hour users
- ✓ Good for resource-intensive tasks that need more time
- ✓ Can also use 0 0 * * 6,0 (order does not matter)
Frequently Asked Questions
How do I specify weekends in cron?
Use 0,6 in the day-of-week field where 0 is Sunday and 6 is Saturday. The expression 0 0 * * 0,6 runs at midnight on both Saturday and Sunday.
Can I use SAT,SUN instead of 0,6?
Some cron implementations (like Vixie cron and systemd) support three-letter day names. Check your specific environment for compatibility.