#!/opt/homebrew/bin/bash # Nightly by launchd (config/xyz.sethpc.mac-backup.plist). Mirrors the DAW-relevant # dirs to tank. History comes from sanoid snapshots of tank/backups/mac on pve173, # which is what makes `--delete` safe. set -euo pipefail src=() for d in "$HOME/Music/Ableton" "$HOME/Documents"; do [[ -d $d ]] && src+=("$d"); done [[ ${#src[@]} -gt 0 ]] || { echo "nothing to back up yet"; exit 0; } # Remote path is relative to the rrsync root (/tank/backups/mac) set in root's authorized_keys on pve173. # -i pins the jailed key; the Host * default (id_ed25519_homelab) has a root shell on pve173 and must NOT be offered first. # Check the jail holds: ssh -o IdentitiesOnly=yes -i ~/.ssh/id_ed25519 root@192.168.0.173 id -> "rrsync error: ... does not run rsync" (NOT `true`: rrsync whitelists it as a ping). exec /opt/homebrew/bin/rsync -a --delete -e "ssh -o BatchMode=yes -o IdentitiesOnly=yes -i $HOME/.ssh/id_ed25519" "${src[@]}" root@192.168.0.173:/