Skip to content

Commit 0dce4ed

Browse files
Added: STOP_SERVER_DELAY_COMMAND (#4109)
1 parent 8517077 commit 0dce4ed

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

docs/configuration/misc-options.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ If this behavior interferes with the log content, then disable TTY or remove the
5050

5151
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.
5252

53+
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.
54+
5355
!!! warning "Increase stop grace period"
5456

5557
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
242244
243245
```
244246
[init] 2022-02-05 16:58:33+00:00 Starting the Minecraft server...
245-
```
247+
```

docs/variables.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
246246
<td><code></code></td>
247247
<td>⬜️</td>
248248
</tr>
249+
<tr>
250+
<td><code>STOP_SERVER_DELAY_COMMAND</code></td>
251+
<td>To set a custom command to run at the start of this delay period, set <code>STOP_SERVER_DELAY_COMMAND</code> to the full command. This will run in place of the announcement.</td>
252+
<td><code></code></td>
253+
<td>⬜️</td>
254+
</tr>
249255
<tr>
250256
<td><code>PROXY</code></td>
251257
<td>You may configure the use of an HTTP/HTTPS proxy by passing the proxy's URL</td>
@@ -670,4 +676,4 @@ This image maps known server properties as described in [this section](configura
670676
<td></td>
671677
<td><code></code></td>
672678
<td>⬜️</td>
673-
</tr> -->
679+
</tr> -->

scripts/start-finalExec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ fi
481481
if [[ ${STOP_SERVER_ANNOUNCE_DELAY} ]]; then
482482
mcServerRunnerArgs+=(--stop-server-announce-delay "${STOP_SERVER_ANNOUNCE_DELAY}s")
483483
fi
484+
if [[ ${STOP_SERVER_DELAY_COMMAND} ]]; then
485+
mcServerRunnerArgs+=(--stop-server-delay-command "${STOP_SERVER_DELAY_COMMAND}s")
486+
fi
484487
if isTrue "${ENABLE_SSH}"; then
485488
mcServerRunnerArgs+=(--remote-console)
486489
fi

0 commit comments

Comments
 (0)