From 874a0db1a1c9adddcc73d20c02ae8771b9b37d0a Mon Sep 17 00:00:00 2001 From: mathiascode Date: Sun, 22 Dec 2019 20:59:31 +0200 Subject: [PATCH] Improve alive checker --- script/alivecheck.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/alivecheck.sh b/script/alivecheck.sh index 3485c56..344a3df 100755 --- a/script/alivecheck.sh +++ b/script/alivecheck.sh @@ -15,11 +15,12 @@ while true; do # 3 minutes, kill the server if [ "$(env printf '\xFE' | nc -w 5 localhost 25565 | wc -m)" -eq 0 ] || - [ "$(( $(date +%s) - $(date -r $logfile +%s) ))" -gt 180 ]; then + [ "$(( $(date +%s) - $(date -r $logfile +%s) ))" -gt 180 ] || + [ "$(tail -5 $logfile | grep -cE 'Server thread|Paper Watchdog Thread|Async Chat Thread')" -eq 0 ]; then if [ "$(tail -20 $logfile | grep -c 'ERROR]: Requested chunk')" -eq 1 ]; then rm -rf $HOME/worlds/ fi pkill -9 java fi fi -done +done \ No newline at end of file