Cron: Every Week
0 0 * * 0 runs once a week, at midnight on Sunday — the day-of-week field's 0 refers to Sunday in standard cron. Weekly schedules are common for digest emails, full backups, and maintenance windows that don't need to run more often.
0 0 * * 0
Examples & Variations
Common Mistakes
- Confusing day-of-week numbering — in standard cron, 0 and 7 both mean Sunday, 1 is Monday, and 6 is Saturday. It's easy to be off by one if you assume 0 is Monday.
- Scheduling a weekly job at midnight Sunday without checking whether that's actually a low-traffic window for your specific application.
- Relying on 'every 7 days from deploy' semantics — cron's weekly schedule is always anchored to a specific day of the week, not to a rolling 7-day counter from when the job was added.
Best Practices
- Use the day-of-week field explicitly (0 0 * * 0) rather than trying to approximate weekly behavior with the day-of-month field, which doesn't align to calendar weeks.
- Pick the actual lowest-traffic day and hour for your application rather than defaulting to Sunday midnight out of habit.
- For weekly reports meant for a business audience, consider firing on a weekday morning (like Monday 8 AM) instead of the weekend, so the output is fresh when people check it.
Frequently Asked Questions
- Is 0 0 * * 0 the same as @weekly?
- Yes — @weekly is a standard cron nickname that expands to 0 0 * * 0, firing once at midnight on Sunday.
- How do I run something every week on a day other than Sunday?
- Change the day-of-week field to the number for your desired day: 0 0 * * 1 for Monday, 0 0 * * 5 for Friday, and so on (0=Sunday through 6=Saturday).
- Can cron run something every 2 weeks?
- Not directly with a single day-of-week field — standard cron has no concept of alternating weeks. The common workaround is to check the ISO week number inside the job script and exit early on off-weeks.