Add Kopia backup stack with Backblaze B2 offsite target.
Protects /config, selective labdata, and nightly DB dumps; documents homelab improvement plan briefs.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
[ -f /etc/backup.env ] && . /etc/backup.env
|
||||
|
||||
NTFY_URL="${NTFY_URL:-https://ntfy.ginnoir.com/backup}"
|
||||
NTFY_TITLE="${NTFY_TITLE:-ValhallaBackup}"
|
||||
|
||||
notify() {
|
||||
priority="$1"
|
||||
message="$2"
|
||||
curl -sf -H "Title: ${NTFY_TITLE}" -H "Priority: ${priority}" -d "${message}" "${NTFY_URL}" >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
if ! docker ps --format '{{.Names}}' | grep -qx kopia; then
|
||||
notify high "Kopia container not running — snapshots skipped"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FAILED=0
|
||||
while IFS= read -r path || [ -n "${path}" ]; do
|
||||
case "${path}" in ''|\#*) continue ;; esac
|
||||
if ! docker exec kopia kopia snapshot create "${path}"; then
|
||||
FAILED=1
|
||||
fi
|
||||
done < /snapshot-paths.txt
|
||||
|
||||
if [ "${FAILED}" -eq 0 ]; then
|
||||
notify default "Snapshots OK ($(date +%Y-%m-%d\ %H:%M))"
|
||||
else
|
||||
notify high "One or more snapshots FAILED — check docker logs kopia"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user