Fix backup cron scripts for Kopia password and MariaDB dumps.
Pass KOPIA_REPOSITORY_PASSWORD into snapshot create; use MARIADB_ROOT_PASSWORD for romm and bookstack app user for bookstack root mismatch.
This commit is contained in:
@@ -5,6 +5,7 @@ set -eu
|
||||
|
||||
NTFY_URL="${NTFY_URL:-https://ntfy.ginnoir.com/backup}"
|
||||
NTFY_TITLE="${NTFY_TITLE:-ValhallaBackup}"
|
||||
KOPIA_PASSWORD="${KOPIA_REPOSITORY_PASSWORD:-${KOPIA_PASSWORD:-}}"
|
||||
|
||||
notify() {
|
||||
priority="$1"
|
||||
@@ -12,6 +13,11 @@ notify() {
|
||||
curl -sf -H "Title: ${NTFY_TITLE}" -H "Priority: ${priority}" -d "${message}" "${NTFY_URL}" >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
if [ -z "${KOPIA_PASSWORD}" ]; then
|
||||
notify high "KOPIA_REPOSITORY_PASSWORD not set — snapshots skipped"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! docker ps --format '{{.Names}}' | grep -qx kopia; then
|
||||
notify high "Kopia container not running — snapshots skipped"
|
||||
exit 1
|
||||
@@ -20,7 +26,7 @@ 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
|
||||
if ! docker exec -e KOPIA_PASSWORD="${KOPIA_PASSWORD}" kopia kopia snapshot create "${path}"; then
|
||||
FAILED=1
|
||||
fi
|
||||
done < /snapshot-paths.txt
|
||||
|
||||
Reference in New Issue
Block a user