From 947be33fcf5bb52ef4a94f9d5a02f53af541681d Mon Sep 17 00:00:00 2001 From: szaimen Date: Wed, 6 Apr 2022 21:58:01 +0200 Subject: [PATCH] some small improvements Signed-off-by: szaimen --- Containers/mastercontainer/backup-time-file-watcher.sh | 7 ++++++- Containers/mastercontainer/cron.sh | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Containers/mastercontainer/backup-time-file-watcher.sh b/Containers/mastercontainer/backup-time-file-watcher.sh index 593743e3..e7e34d16 100644 --- a/Containers/mastercontainer/backup-time-file-watcher.sh +++ b/Containers/mastercontainer/backup-time-file-watcher.sh @@ -1,7 +1,7 @@ #!/bin/bash restart_process() { - echo "Restarting cron.sh because daily backup time was set or unset." + echo "Restarting cron.sh because daily backup time was set, changed or unset." pkill cron.sh } @@ -9,8 +9,13 @@ file_present() { if [ -f "/mnt/docker-aio-config/data/daily_backup_time" ]; then if [ "$FILE_PRESENT" = 0 ]; then restart_process + else + if [ -n "$BACKUP_TIME" ] && [ "$(cat "/mnt/docker-aio-config/data/daily_backup_time")" != "$BACKUP_TIME" ]; then + restart_process + fi fi FILE_PRESENT=1 + BACKUP_TIME="$(cat "/mnt/docker-aio-config/data/daily_backup_time")" else if [ "$FILE_PRESENT" = 1 ]; then restart_process diff --git a/Containers/mastercontainer/cron.sh b/Containers/mastercontainer/cron.sh index 88b8d631..ced0c744 100644 --- a/Containers/mastercontainer/cron.sh +++ b/Containers/mastercontainer/cron.sh @@ -28,7 +28,10 @@ while true; do echo "Daily backup has started" # Delete all active sessions and create a lock file - rm -f "/mnt/docker-aio-config/session/"* + # But don't kick out the user if the mastercontainer was just updated since we block the interface either way with the lock file + if [ "$LOCK_FILE_PRESENT" = 0 ]; then + rm -f "/mnt/docker-aio-config/session/"* + fi sudo -u www-data touch "/mnt/docker-aio-config/data/daily_backup_running" # Check if apache is running/stopped, watchtower is stopped and backupcontainer is stopped