some small improvements

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-04-06 21:58:01 +02:00
parent 340f7450ca
commit 947be33fcf
2 changed files with 10 additions and 2 deletions

View file

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

View file

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