Skip to content

Backup Strategy Documentation

1. Overview

The servers use Restic for backups, scheduled via cron jobs. The cron jobs define when the backup script /usr/local/sbin/restic-ops.sh runs.

Initially, all servers were scheduled using the @daily tag, which is equivalent to midnight every day (00:00):

@daily bash /usr/local/sbin/restic-ops.sh

# Equivalent numeric form:
0 0 * * * bash /usr/local/sbin/restic-ops.sh

2. Cron Syntax Explanation

Cron usually uses the following 5-field format:

MIN HOUR DOM MON DOW COMMAND
Example:
0 4 * * 2 /usr/local/sbin/restic-ops.sh
│    └── Day of week (2 = Tuesday)   └──── Month (* = every month)  └────── Day of month (* = every day) └──────── Hour (4 = 4 AM)
└────────── Minute (0)

  • Time is in 24-hour format.

  • * means “every” (e.g., every day, every month).

  • DOW = 0–7 (0 or 7 = Sunday, 1 = Monday, … 6 = Saturday).

3 Updated Backup Schedule Per Server

The servers peak, duodecilion and apex passed from looking like this:

@daily bash /usr/local/sbin/restic-ops.sh

to this:

Server New Schedule Description
peak.ti.bfh.ch 0 0 * * * bash /usr/local/sbin/restic-ops.sh Daily at midnight
duodecillion.ti.bfh.ch 0 1 * * * bash /usr/local/sbin/restic-ops.sh Daily at 1 AM
apex.ti.bfh.ch 0 2 * * * bash /usr/local/sbin/restic-ops.sh Daily at 2 AM
pollux.ti.bfh.ch 0 3 * * * /usr/local/sbin/restic-ops.sh Daily at 3 AM
gemini.ti.bfh.ch 0 4 * * 2 /usr/local/sbin/restic-ops.sh Weekly on Tuesday at 4 AM (unchanged)
castor.ti.bfh.ch 0 5 * * * /usr/local/sbin/restic-ops.sh Daily at 5 AM
vertex.ti.bfh.ch 0 6 * * * /usr/local/sbin/restic-ops.sh Daily at 6 AM

We can verify this with sudo crontab -l

4. Special Notes

System Startup Mount (apex only)

The apex server is the only one wiht the following cron line:

@reboot mount -a

  • This runs once at system startup.

  • mount -a mounts all filesystems listed in /etc/fstab.

  • Ensures backup drives or network filesystems are available before the backup script runs.

System cron jobs

Beyond individual crontab entries, there are system-wide cron jobs that run scripts in the following directories:

/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly

These are called via /etc/crontab. Example from the peak server:

17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
47 6 * * 7 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
52 6 1 * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }

Explanation (more for myself lol): * run-parts /etc/cron.* runs all executable scripts in the specified directory.

  • anacron is a tool that ensures scheduled jobs run even if the system was off at the scheduled time.

  • These system cron jobs are separate from the Restic backups, but can be observed in the logs:

    grep CRON /var/log/syslog
    

5. Verification

To confirm backups are running: * Check root's cron:

sudo crontab -l
* Check the recent cron logs:
grep CRON /var/log/syslog | grep restic-ops.sh