From bb1e5fa826afb4df78c023494f2ab61108c620e6 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sat, 24 Jan 2026 15:25:56 +0000 Subject: [PATCH] Fix healthcheck --- src/backup-wrapper.sh | 10 +++++++++- src/backup.sh | 2 -- 2 files changed, 9 insertions(+), 3 deletions(-) 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