Run Weekly Saturday Midnight Backups | CronBase

cron expression Standard
$ 0 0 * * 6

Every Saturday at midnight

The `0 0 * * 6` cron expression schedules a task to run once a week at exactly midnight every Saturday. It is commonly used in production environments for heavy weekly maintenance jobs, database optimization, full system backups, and generating weekly analytical reports during low-traffic weekend hours.

Minute
0
Hour
0
Day of Month
*
Month
*
Day of Week
6
How it works

Next 5 Runs

  • in 6d 3h
  • in 13d 3h
  • in 20d 3h
  • in 27d 3h
  • in 34d 3h

* Tools

Code & Implementations

Bash
#!/usr/bin/env bash
set -euo pipefail
# Production Saturday Midnight Backup Script
BACKUP_DIR="/var/backups/weekly"
LOG_FILE="/var/log/weekly_backup.log"
exec > >(tee -ia "$LOG_FILE") 2>&1
echo "[$(date -u)] Starting weekly backup execution..."
if ! mkdir -p "$BACKUP_DIR"; then
  echo "Error: Failed to create backup directory" >&2
  exit 1
fi
# Simulate backup logic with error handling
if tar -czf "$BACKUP_DIR/data-$(date +%F).tar.gz" /data/db; then
  echo "[$(date -u)] Weekly backup completed successfully."
else
  echo "Error: Weekly backup failed!" >&2
  exit 1
fi
Setup notes

Save this script to /usr/local/bin/weekly-backup.sh, make it executable with chmod +x, and add 0 0 * * 6 /usr/local/bin/weekly-backup.sh to the root crontab using crontab -e.

Last verified:

Partner UptimeRobot

Keep this cron job monitored 24/7

UptimeRobot alerts you the moment a scheduled job stops responding. Free plan monitors up to 50 endpoints — no credit card required.

Platform Equivalents

AWS EventBridge

Standard cron expressions often need conversion for AWS EventBridge schedules.

EventBridge Rule
cron(0 0 ? * 6 *)

Systemd Timer

OnCalendarSat *-*-* 00:00:00

my-task.timer
[Unit]
Description=Timer for cron expression: 0 0 * * 6

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

[Install]
WantedBy=timers.target

Last verified:

Frequently Asked Questions

How does Daylight Saving Time (DST) affect the Saturday midnight execution?

Depending on your system's timezone, a DST transition can cause the job to run twice or not at all if it occurs on that night. To prevent this, configure your cron daemon or scheduler to run on UTC.

What happens if a previous week's execution is still running when the next Saturday comes?

For standard cron, the job will spawn concurrently, potentially causing race conditions. Use locking mechanisms like `flock` in Bash, or set `concurrencyPolicy: Forbid` in Kubernetes to prevent overlapping.

Can I run this job on Friday night instead of Saturday night?

Yes, you can change the day-of-week field from `6` (Saturday) to `5` (Friday). The expression would then be `0 0 * * 5`, executing at midnight as Friday transitions to Saturday.

How should I monitor a weekly job to ensure it actually ran?

Since weekly jobs run infrequently, passive logging is insufficient. Use a push-based monitoring system ("Dead Man's Snitch") where the job pings an external service on completion; if no ping is received by 00:15 Saturday, an alert is raised.

Is there a way to run the job at 2:00 AM on Saturday instead of midnight?

Yes, modifying the hour field from `0` to `2` changes the execution time. The expression `0 2 * * 6` is often preferred to avoid resource contention with other midnight-scheduled tasks.

* Explore

Related expressions you might need

Last verified:

Was this helpful?