From dd8a61792fda640e75192b56cf16bee8c12d33b5 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sat, 9 Aug 2025 22:58:53 +0100 Subject: [PATCH] Fix healthcheck caching volume --- docker-compose.yml | 2 +- src/backup.sh | 2 +- src/healthcheck.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d617467..f05b746 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,7 @@ services: - /volumes/backup/logs:/backup-logs # we will store the output of the backup commands in this folder - borg-cache:/root/.cache/borg # speed up subsequent backups - - health-flag:/backup_completion_time.log # this is used to determine if the backup was successful and when it was last run + - health-flag:/health/backup_completion_time.log # this is used to determine if the backup was successful and when it was last run - /bulk/backup:/local-backup # this is an example target backup path for BORG_REPO_1 from above - /volumes/backup/config/id_rsa:/root/.ssh/id_rsa # this is an example for mounting an ssh key for a remote repo (BORG_REPO_0 above) diff --git a/src/backup.sh b/src/backup.sh index eafb4e8..67f62f1 100755 --- a/src/backup.sh +++ b/src/backup.sh @@ -49,4 +49,4 @@ borg compact --threshold=5 --cleanup-commits --verbose --progress btrfs subvolume delete /snapshot/source echo "Finished backup script at `date`" -date > /backup_completion_time.log # this used by the healtcheck +date > /health/backup_completion_time.log # this used by the healtcheck diff --git a/src/healthcheck.sh b/src/healthcheck.sh index 6912ad3..ba73b99 100755 --- a/src/healthcheck.sh +++ b/src/healthcheck.sh @@ -2,9 +2,9 @@ set -e -if [ -f /backup_completion_time.log ]; then +if [ -f /health/backup_completion_time.log ]; then current_time=$(date +%s) - backup_time=$(date --file /backup_completion_time.log +%s) + backup_time=$(date --file /health/backup_completion_time.log +%s) age_in_seconds=$((current_time - backup_time)) if [ ${age_in_seconds} -lt ${MAX_BACKUP_AGE_SECONDS} ]; then