A twelve-line backup habit

Every clever backup system I built, I eventually stopped feeding. What stuck is a dumb script and a calendar entry:

#!/bin/sh
# weekly.sh — runs on the backup box, pulls from the VPS
set -eu
box="me@myvps.example"
dest="vps/$(date -u +%F)"

rsync -a --dry-run "$box:/var/www/"   "vps/current/www/"    # look first
rsync -a            "$box:/var/www/"   "vps/current/www/"
rsync -a            "$box:/etc/caddy/" "vps/current/caddy/"
rsync -a "vps/current/" "$dest/"                             # dated snapshot

Four rules made it survive where the clever versions didn't:

No personal data lives on this box, so /var/www plus a couple of /etc directories really is the whole estate. Small estate, small script.

← All notes