aboutsummarylogtreecommitdiffstats
path: root/papermc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'papermc.sh')
-rwxr-xr-xpapermc.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/papermc.sh b/papermc.sh
index f62aa2702d95..e4e7ed485025 100755
--- a/papermc.sh
+++ b/papermc.sh
@@ -140,7 +140,8 @@ idle_server_daemon() {
no_player=$(( IDLE_IF_TIME - 300 ))
# Game server is down, listen on port ${GAME_PORT} for incoming connections
echo -n "Netcat: "
- ${NETCAT_CMD} -v -l -p ${GAME_PORT} && echo "Netcat caught an connection. The server is coming up again..."
+ ${NETCAT_CMD} -v -l -p ${GAME_PORT} 2>&1 | (grep -m1 -i "connect" && pkill -P $$ ${NETCAT_CMD}) || true
+ echo "Netcat caught a connection. The server is coming up again..."
IDLE_SERVER="false" ${myname} start
fi
else
@@ -152,7 +153,8 @@ idle_server_daemon() {
no_player=$(( IDLE_IF_TIME - 300 ))
# Game server is down, listen on port ${GAME_PORT} for incoming connections
echo -n "Netcat: "
- ${NETCAT_CMD} -v -l -p ${GAME_PORT} && echo "Netcat caught an connection. The server is coming up again..."
+ ${NETCAT_CMD} -v -l -p ${GAME_PORT} 2>&1 | (grep -m1 -i "connect" && pkill -P $$ ${NETCAT_CMD}) || true
+ echo "Netcat caught a connection. The server is coming up again..."
IDLE_SERVER="false" ${myname} start
fi
done