gnirehtet
gnirehtet copied to clipboard
hey i have a issue that whenever i open a game called mobile legend it automatically disconnect help me please urgent
I am using a script to make it re-execute as soon as the disconnect message shows up in log. It will not help in game that much tho, cuz, as you disconnect you will always have few sec on lag. Same thing happening with me in Mobile legend.
LOG_FILE="gnirehtet.log"
ERROR_LOGGED=false
while true; do
./gnirehtet run >$LOG_FILE 2>&1 &
GNIREHTET_PID=$!
echo "Rebooted"
while ps -p $GNIREHTET_PID >/dev/null; do
if grep -q "Client #0 disconnected" $LOG_FILE; then
if [ "$ERROR_LOGGED" = false ]; then
ERROR_LOGGED=true
echo "Error detected in log. Restarting the command..."
kill -9 $GNIREHTET_PID
break
fi
else
ERROR_LOGGED=false
fi
sleep 1
done
sleep 2
done