diff --git a/files/autopause/autopause-fcns.sh b/files/autopause/autopause-fcns.sh index aea37a6f..5ebae93c 100644 --- a/files/autopause/autopause-fcns.sh +++ b/files/autopause/autopause-fcns.sh @@ -13,7 +13,7 @@ rcon_client_exists() { } mc_server_listening() { - [[ -n $(netstat -tln | grep "0.0.0.0:$SERVER_PORT" | grep LISTEN) ]] + [[ -n $(netstat -tln | grep -e "0.0.0.0:$SERVER_PORT" -e ":::$SERVER_PORT" | grep LISTEN) ]] } java_clients_connected() { @@ -29,7 +29,7 @@ java_clients_connected() { # remember, that the host network mode does not work with autopause because of the knockd utility for (( i=0; i<${#connections[@]}; i++ )) do - if [[ ! $(echo "${connections[$i]}" | awk '{print $5}') =~ ^\s*127\.0\.0\.1:.*$ ]] ; then + if [[ ! $(echo "${connections[$i]}" | awk '{print $5}') =~ ^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$ ]] ; then # not localhost return 0 fi