Fix healthcheck caching volume

This commit is contained in:
Andras Schmelczer 2025-08-09 22:58:53 +01:00
parent 8261031e11
commit dd8a61792f
3 changed files with 4 additions and 4 deletions

View file

@ -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)

View file

@ -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

View file

@ -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