rsync snapshot backup with hard links
BASH · 7 lines · 0.2 KB
#!/usr/bin/env bash
set -euo pipefail
SRC=/var/www/
DST=/backup/www
NOW=$(date +%F)
rsync -aH --delete --link-dest="$DST/latest" "$SRC" "$DST/$NOW"
ln -sfn "$DST/$NOW" "$DST/latest"