diff --git a/src/backup-wrapper.sh b/src/backup-wrapper.sh index 2e55ecb..5e99c17 100755 --- a/src/backup-wrapper.sh +++ b/src/backup-wrapper.sh @@ -43,14 +43,22 @@ main() { else local index=0 local configurations_found=false + local any_failed=false while configure_environment $index; do - execute_script || true + execute_script || any_failed=true configurations_found=true unset BORG_PASSPHRASE BORG_REMOTE_PATH BORG_REPO ((index++)) done + echo "Finished backup script at $(date)" + if [[ $any_failed == false ]]; then + date > /health/backup_completion_time.log # this used by the healtcheck + else + echo "Skipping completion log due to backup failure(s)" + fi + if [[ $configurations_found == false ]]; then echo "No valid configuration found. Please ensure environment variables are set properly." fi diff --git a/src/backup.sh b/src/backup.sh index bf75561..bb85da5 100755 --- a/src/backup.sh +++ b/src/backup.sh @@ -48,5 +48,3 @@ borg compact --threshold=5 --cleanup-commits --verbose --progress btrfs subvolume delete /snapshot/btrfs-root -echo "Finished backup script at `date`" -date > /health/backup_completion_time.log # this used by the healtcheck