From 909f7fbb6d1c09740576374452f72f8649312333 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sat, 24 Jan 2026 16:15:04 +0000 Subject: [PATCH] Fix healtcheck again --- src/backup-wrapper.sh | 9 ++++++++- src/schedule.sh | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/backup-wrapper.sh b/src/backup-wrapper.sh index 5e99c17..a423edb 100755 --- a/src/backup-wrapper.sh +++ b/src/backup-wrapper.sh @@ -37,9 +37,16 @@ configure_environment() { } main() { + # Clear health log at start - only a fully successful run should be marked healthy + rm -f /health/backup_completion_time.log + if [ -n "$BORG_REPO" ]; then # fallback case if multi-target backup isn't needed - execute_script + if execute_script; then + date > /health/backup_completion_time.log + else + echo "Skipping completion log due to backup failure" + fi else local index=0 local configurations_found=false diff --git a/src/schedule.sh b/src/schedule.sh index c7c4cdd..4956b0a 100755 --- a/src/schedule.sh +++ b/src/schedule.sh @@ -10,7 +10,7 @@ get_log_file_name() { echo "/backup-logs/backup_$(date +%Y)_week_$(date +%U).log" } -echo "Starting schedule script at `date`" | log_message +echo "Starting schedule script at $(date)" | log_message while true; do exec /src/backup-wrapper.sh 2>&1 | log_message