Check latest time in log

This commit is contained in:
mathias 2019-08-06 15:50:22 +03:00
parent 6f05b1ab55
commit c485bdfff6

View file

@ -34,9 +34,12 @@ sleep 90
while true; do
sleep 120
if [ "$(env printf '\xFE' | nc -w 5 localhost 25565 | wc -m)" -eq 0 ]; then
kill -9 $(pgrep java)
if tail -20 $HOME/logs/latest.log | grep -c 'ERROR]: Requested chunk'; then
if [ "$(env printf '\xFE' | nc -w 5 localhost 25565 | wc -m)" -eq 0 ] ||
[ "$(( $(date +%s) - $(tail -1 $HOME/logs/latest.log | grep -oP '(?<=\[).*?(?=\])' || date +%T | head -1 | date -f - +%s) ))" -gt 180 ]; then
if [ "$(pgrep java)" ]; then
kill -9 $(pgrep java)
fi
if [ "$(tail -20 $HOME/logs/latest.log | grep -c 'ERROR]: Requested chunk')" ]; then
rm -rf $HOME/worlds/
fi
fi