2022-04-05 01:12:07 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
restart_process() {
|
2022-04-07 03:58:01 +08:00
|
|
|
echo "Restarting cron.sh because daily backup time was set, changed or unset."
|
2022-04-05 01:12:07 +08:00
|
|
|
pkill cron.sh
|
|
|
|
}
|
|
|
|
|
|
|
|
file_present() {
|
|
|
|
if [ -f "/mnt/docker-aio-config/data/daily_backup_time" ]; then
|
|
|
|
if [ "$FILE_PRESENT" = 0 ]; then
|
|
|
|
restart_process
|
2022-04-07 03:58:01 +08:00
|
|
|
else
|
2022-07-11 03:47:25 +08:00
|
|
|
if [ -n "$BACKUP_TIME" ] && [ "$(head -1 "/mnt/docker-aio-config/data/daily_backup_time")" != "$BACKUP_TIME" ]; then
|
2022-04-07 03:58:01 +08:00
|
|
|
restart_process
|
|
|
|
fi
|
2022-04-05 01:12:07 +08:00
|
|
|
fi
|
|
|
|
FILE_PRESENT=1
|
2022-07-11 03:47:25 +08:00
|
|
|
BACKUP_TIME="$(head -1 "/mnt/docker-aio-config/data/daily_backup_time")"
|
2022-04-05 01:12:07 +08:00
|
|
|
else
|
|
|
|
if [ "$FILE_PRESENT" = 1 ]; then
|
|
|
|
restart_process
|
|
|
|
fi
|
|
|
|
FILE_PRESENT=0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
file_present
|
2022-04-07 03:00:20 +08:00
|
|
|
sleep 2
|
2022-04-05 01:12:07 +08:00
|
|
|
done
|