diff --git a/scripts/homelab-backup b/scripts/homelab-backup index ccbbba9..e3b0e6c 100755 --- a/scripts/homelab-backup +++ b/scripts/homelab-backup @@ -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