From 0dce4ed863d284d41dd145172fbb9d45d9f45a54 Mon Sep 17 00:00:00 2001 From: James Wagner Date: Tue, 16 Jun 2026 05:22:32 -0700 Subject: [PATCH] Added: STOP_SERVER_DELAY_COMMAND (#4109) --- docs/configuration/misc-options.md | 4 +++- docs/variables.md | 8 +++++++- scripts/start-finalExec | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/configuration/misc-options.md b/docs/configuration/misc-options.md index da5d6888..a02922f7 100644 --- a/docs/configuration/misc-options.md +++ b/docs/configuration/misc-options.md @@ -50,6 +50,8 @@ If this behavior interferes with the log content, then disable TTY or remove the To allow time for players to finish what they're doing during a graceful server shutdown, set `STOP_SERVER_ANNOUNCE_DELAY` to a number of seconds to delay after an announcement is posted by the server. +To set a custom command to run at the start of this delay period, set `STOP_SERVER_DELAY_COMMAND` to the full command. This will run in place of the announcement. + !!! warning "Increase stop grace period" The Docker stop grace period must be increased to a value longer than the announce delay. The value to use that is longer than announce delay will vary based upon the amount of time it takes for final world data saving. If the container exits with exit code 137, then that indicates a longer grace period is needed. @@ -242,4 +244,4 @@ To also include the timestamp with each log, set `LOG_TIMESTAMP` to "true". The ``` [init] 2022-02-05 16:58:33+00:00 Starting the Minecraft server... -``` +``` \ No newline at end of file diff --git a/docs/variables.md b/docs/variables.md index 1f7d0956..8685ca30 100644 --- a/docs/variables.md +++ b/docs/variables.md @@ -246,6 +246,12 @@ alternatively, you can mount: /etc/localtime:/etc/localtime:ro ⬜️ + + STOP_SERVER_DELAY_COMMAND + To set a custom command to run at the start of this delay period, set STOP_SERVER_DELAY_COMMAND to the full command. This will run in place of the announcement. + + ⬜️ + PROXY You may configure the use of an HTTP/HTTPS proxy by passing the proxy's URL @@ -670,4 +676,4 @@ This image maps known server properties as described in [this section](configura ⬜️ - --> + --> \ No newline at end of file diff --git a/scripts/start-finalExec b/scripts/start-finalExec index 6c77690f..daf019f2 100755 --- a/scripts/start-finalExec +++ b/scripts/start-finalExec @@ -481,6 +481,9 @@ fi if [[ ${STOP_SERVER_ANNOUNCE_DELAY} ]]; then mcServerRunnerArgs+=(--stop-server-announce-delay "${STOP_SERVER_ANNOUNCE_DELAY}s") fi +if [[ ${STOP_SERVER_DELAY_COMMAND} ]]; then + mcServerRunnerArgs+=(--stop-server-delay-command "${STOP_SERVER_DELAY_COMMAND}s") +fi if isTrue "${ENABLE_SSH}"; then mcServerRunnerArgs+=(--remote-console) fi