This commit is contained in:
bee
2026-08-15 19:18:59 +02:00
parent 59aa8a7bcf
commit c63db540e8
32 changed files with 767 additions and 64 deletions
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
set -euo pipefail
now=$(date +"%Y%m%d%H%M")
if ! mountpoint -q {{ hetzner_raid_mount }}
then
echo "[${now}] {{ hetzner_raid_mount }} not mounted, refusing to sync"
exit 1
fi
sync_path() {
local src=$1
local dest=$2
if [ -z "$(ls -A ${src} 2>/dev/null)" ]
then
echo "[${now}] ${src} empty, refusing to sync"
exit 1
fi
echo "[${now}] syncing ${src} to ${dest}"
sudo -u {{ user }} rsync -a --delete --partial \
-e "ssh -p {{ hetzner_port }} -i {{ user_home }}/.ssh/id_ed25519 -o UserKnownHostsFile={{ user_home }}/.ssh/known_hosts -o StrictHostKeyChecking=yes" \
${src}/ \
{{ hetzner_user }}@{{ hetzner_host }}:${dest}/
}
echo "[${now}] offsite sync start"
{% for path in hetzner_paths %}
sync_path {{ path.src }} {{ path.dest }}
{% endfor %}
echo "[${now}] offsite sync done"