From f96efa50be427b774903f59912e701ea622fc666 Mon Sep 17 00:00:00 2001 From: mathiascode Date: Thu, 9 Jan 2020 22:28:34 +0200 Subject: [PATCH] Add back log check --- script/alivecheck.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/alivecheck.sh b/script/alivecheck.sh index 24b5fe0..7cf98d8 100755 --- a/script/alivecheck.sh +++ b/script/alivecheck.sh @@ -14,11 +14,12 @@ while true; do # If localhost:25565 doesn't respond to ping, or if the log file is older than # 3 minutes, kill the server - if [ "$(env printf '\xFE' | nc -w 15 localhost 25565 | wc -m)" -eq 0 ]; then + if [ "$(env printf '\xFE' | nc -w 15 localhost 25565 | wc -m)" -eq 0 ] || + [ "$(( $(date +%s) - $(date -r $logfile +%s) ))" -gt 300 ]; then if [ "$(tail -20 $logfile | grep -c 'ERROR]: Requested chunk')" -eq 1 ]; then rm -rf $HOME/worlds/ fi pkill -9 java fi fi -done \ No newline at end of file +done