13 lines
339 B
Bash
13 lines
339 B
Bash
#!/usr/bin/env bash
|
|
|
|
data_dir='/mnt/data1/gitea/lfs'
|
|
snapshot_dir="${data_dir}.snapshot"
|
|
|
|
# Read-only snapshot for atomic backup
|
|
btrfs subvolume snapshot -r "$data_dir" "$snapshot_dir" || exit $?
|
|
|
|
/usr/local/bin/restic backup "$snapshot_dir"
|
|
|
|
# Always remove snapshot subvolume, even if restic fails
|
|
btrfs subvolume delete "$snapshot_dir"
|