diff options
author | Jeremy Kescher | 2020-01-13 01:18:56 +0100 |
---|---|---|
committer | Jeremy Kescher | 2020-01-13 01:18:56 +0100 |
commit | de8a84677281bebd8129740c48fd526001102a3b (patch) | |
tree | 9a24159f494023c06cd8457660462d92002de0da /papermc.sh | |
parent | 33e9ae32e87d7f36c26eb104b8c399f205a637f0 (diff) | |
download | aur-de8a84677281bebd8129740c48fd526001102a3b.tar.gz |
Prefer nmap's ncat for the idle server daemon as it immediately quits upon connection, thus rebooting the server earlier than both gnu-netcat and openbsd-netcat.
Diffstat (limited to 'papermc.sh')
-rwxr-xr-x | papermc.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/papermc.sh b/papermc.sh index 3f327f394eb8..5948da2006e7 100755 --- a/papermc.sh +++ b/papermc.sh @@ -50,10 +50,10 @@ else fi # Choose which flavor of netcat is to be used -if command -v netcat &> /dev/null; then - NETCAT_CMD="netcat" -elif command -v ncat &> /dev/null; then +if command -v ncat &> /dev/null; then NETCAT_CMD="ncat" +elif command -v netcat &> /dev/null; then + NETCAT_CMD="netcat" else NETCAT_CMD="" fi @@ -139,7 +139,7 @@ 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..." + echo "" | ${NETCAT_CMD} -v -l -p ${GAME_PORT} && echo "Netcat caught an connection. The server is coming up again..." IDLE_SERVER="false" ${myname} start fi else @@ -150,8 +150,8 @@ idle_server_daemon() { # Reset timer and give the player 300 seconds to connect after pinging 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..." + echo -n "Netcat: "netcat + echo "" | ${NETCAT_CMD} -v -l -p ${GAME_PORT} && echo "Netcat caught an connection. The server is coming up again..." IDLE_SERVER="false" ${myname} start fi done |