Skip to content

Commit

Permalink
created two safety function for backup health
Browse files Browse the repository at this point in the history
  • Loading branch information
simylein committed Mar 29, 2021
1 parent 20168b0 commit 2db2da3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions watchdog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,23 @@ fi
# write a function that checks if backups are done regularly
# if any irregularities are detected notify via ingame or logfiles
lastabsoluteworldsize="0"
lastabsolutebackupsize="0"
counter="0"
while true; do
if [[ ${counter} -eq 120 ]]; then
. ./server.settings
if [[ ${absoluteworldsize} < $((${lastabsoluteworldsize} - 65536)) ]]; then
screen -Rd ${servername} -X stuff "tellraw @a [\"\",{\"text\":\"[Script] \",\"color\":\"blue\"},{\"text\":\"info: your world-size is getting smaller - this may result in a corrupted world\"}]$(printf '\r')"
echo "info: your world-size is getting smaller - this may result in a corrupted world" >> ${backuplog}
echo "" >> ${backuplog}
fi
if [[ ${absolutebackupsize} < $((${lastabsolutebackupsize} - 65536)) ]]; then
screen -Rd ${servername} -X stuff "tellraw @a [\"\",{\"text\":\"[Script] \",\"color\":\"blue\"},{\"text\":\"info: your backup-size is getting smaller - this may result in corrupted backups\"}]$(printf '\r')"
echo "info: your backup-size is getting smaller - this may result in corrupted backups" >> ${backuplog}
echo "" >> ${backuplog}
fi
lastabsoluteworldsize="${absoluteworldsize}"
lastabsolutebackupsize="${absolutebackupsize}"
counter="0"
fi
if ! screen -list | grep -q "\.${servername}"; then
Expand Down

0 comments on commit 2db2da3

Please sign in to comment.