add new and improved backup-scripts system

This commit is contained in:
Jef Roosens 2026-04-04 20:48:50 +02:00
parent 6c77886916
commit 77e6f77aba
Signed by: Jef Roosens
GPG key ID: 21FD3D77D56BAF49
8 changed files with 173 additions and 0 deletions

View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
data_dir='{{ item.path }}'
snapshot_dir="${data_dir}.snapshot"
# Read-only snapshot for atomic backup
otel-cli exec --name "btrfs subvolume snapshot" -- btrfs subvolume snapshot -r "$data_dir" "$snapshot_dir" || exit $?
otel-cli exec --name "restic backup directory" -- /usr/local/bin/restic backup "$snapshot_dir"
# Always remove snapshot subvolume, even if restic fails
otel-cli exec --name "btrfs subvolume delete" -- btrfs subvolume delete "$snapshot_dir"