Add SERVER_HOST Environment in mc-monitor command (#2875)

This commit is contained in:
Felipe Paschoal Bergamo
2024-06-05 20:48:35 -03:00
committed by GitHub
parent 8fd98f0315
commit c828985ebe
3 changed files with 11 additions and 3 deletions

View File

@@ -17,13 +17,13 @@ rcon_client_exists() {
}
mc_server_listening() {
mc-monitor status --host localhost --port "$SERVER_PORT" --timeout 10s >& /dev/null
mc-monitor status --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" --timeout 10s >& /dev/null
}
java_clients_connections() {
local connections
if java_running ; then
if ! connections=$(mc-monitor status --host localhost --port "$SERVER_PORT" --show-player-count); then
if ! connections=$(mc-monitor status --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" --show-player-count); then
# consider it a non-zero player count if the ping fails
# otherwise a laggy server with players connected could get paused
connections=1