fix: report failed offsite backup pushes

This commit is contained in:
juvenal.diaz 2026-10-28 09:16:33 -06:00
parent c4b3d2132f
commit 73091460ae
1 changed files with 8 additions and 2 deletions

View File

@ -245,8 +245,14 @@ push_offsite() {
target="${uri#ssh://}"
host="${target%%/*}"
path="/${target#*/}"
ssh -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new "${host}" "mkdir -p '${path}'"
scp -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new "${archive}" "${host}:${path}/"
if ! ssh -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new "${host}" "mkdir -p '${path}'"; then
echo "Offsite SSH target is unreachable: ${host}" >&2
return 1
fi
if ! scp -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new "${archive}" "${host}:${path}/"; then
echo "Offsite SSH upload failed: ${host}:${path}" >&2
return 1
fi
;;
*)
echo "Unsupported HOMELAB_BACKUP_OFFSITE_URI: ${uri}" >&2