From 1279cbd910947e31a3a09ec51b4e4d7ccf1986bc Mon Sep 17 00:00:00 2001 From: f Date: Thu, 26 Dec 2024 11:32:13 -0300 Subject: [PATCH] fix: exit immediately on error --- backup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backup.sh b/backup.sh index 511d641..cc1ccff 100755 --- a/backup.sh +++ b/backup.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e # Password can't be empty test -n "${BORG_PASSPHRASE}" @@ -35,7 +36,7 @@ for signal in TERM QUIT HUP EXIT INT KILL; do done # It'll fail the second time -borg init --encryption=repokey "${SSH_ALIAS}:${DEST}" +borg init --encryption=repokey "${SSH_ALIAS}:${DEST}" || true borg create -v --stats "${SSH_ALIAS}:${DEST}::${DATE}" "${ORIG}" borg prune -v --stats --keep-daily ${KEEP} "${SSH_ALIAS}:${DEST}" borg list "${SSH_ALIAS}:${DEST}"