mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-06-02 08:49:43 +00:00
Add SERVER_HOST Environment in mc-monitor command (#2875)
This commit is contained in:
committed by
GitHub
parent
8fd98f0315
commit
c828985ebe
+1
-1
@@ -13,6 +13,6 @@ elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -ax -o stat,comm | grep 'java' |
|
|||||||
echo "Java process suspended by Autopause function"
|
echo "Java process suspended by Autopause function"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
mc-monitor status "${MC_HEALTH_EXTRA_ARGS[@]}" --host localhost --port "${SERVER_PORT:-25565}"
|
mc-monitor status "${MC_HEALTH_EXTRA_ARGS[@]}" --host "${SERVER_HOST:-localhost}" --port "${SERVER_PORT:-25565}"
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -55,6 +55,14 @@ To allow time for players to finish what they're doing during a graceful server
|
|||||||
|
|
||||||
The grace period can be increased using [the -t option on docker-compose down](https://docs.docker.com/compose/reference/down/) or set the [stop_grace_period](https://docs.docker.com/compose/compose-file/05-services/#stop_grace_period) in the compose file.
|
The grace period can be increased using [the -t option on docker-compose down](https://docs.docker.com/compose/reference/down/) or set the [stop_grace_period](https://docs.docker.com/compose/compose-file/05-services/#stop_grace_period) in the compose file.
|
||||||
|
|
||||||
|
## Configuration Options for Minecraft Server Health Monitoring
|
||||||
|
|
||||||
|
The image tags include specific variables to simplify configuration for monitoring the health of a Minecraft server:
|
||||||
|
|
||||||
|
- `-e SERVER_HOST=localhost` : This variable sets the host address of the Minecraft server to be monitored. By default, it is set to `localhost`, but you can replace it with the actual hostname or IP address of your Minecraft server.
|
||||||
|
|
||||||
|
- `-e SERVER_PORT=25565` : This variable sets the port number on which the Minecraft server is running. By default, Minecraft servers run on port 25565, but if your server is configured to use a different port, you should replace `25565` with the correct port number. This helps the monitoring system to accurately check the health status of the Minecraft server on the specified port.
|
||||||
|
|
||||||
## OpenJ9 Specific Options
|
## OpenJ9 Specific Options
|
||||||
|
|
||||||
The openj9 image tags include specific variables to simplify configuration:
|
The openj9 image tags include specific variables to simplify configuration:
|
||||||
|
|||||||
@@ -17,13 +17,13 @@ rcon_client_exists() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mc_server_listening() {
|
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() {
|
java_clients_connections() {
|
||||||
local connections
|
local connections
|
||||||
if java_running ; then
|
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
|
# consider it a non-zero player count if the ping fails
|
||||||
# otherwise a laggy server with players connected could get paused
|
# otherwise a laggy server with players connected could get paused
|
||||||
connections=1
|
connections=1
|
||||||
|
|||||||
Reference in New Issue
Block a user