From 270362b152afa1318d732200ac9645a8823e4f8b Mon Sep 17 00:00:00 2001 From: timvisee Date: Thu, 25 Nov 2021 13:51:24 +0100 Subject: [PATCH] Use consistent documentation file names --- docs/command-bash.md | 41 +++++++++++++++++++++++++++++++++++++++++ docs/command_bash.md | 42 +----------------------------------------- res/lazymc.toml | 2 +- 3 files changed, 43 insertions(+), 42 deletions(-) create mode 100644 docs/command-bash.md mode change 100644 => 120000 docs/command_bash.md diff --git a/docs/command-bash.md b/docs/command-bash.md new file mode 100644 index 0000000..c6c4a77 --- /dev/null +++ b/docs/command-bash.md @@ -0,0 +1,41 @@ +# Use bash script to start server + +You may use a `bash` script to start your server rather than invoking `java` +directly. This requires some changes though to ensure your server properly shuts +down. + +When lazymc stops your server it sends a [`SIGTERM`][sigterm] signal to the +invoked server process to gracefully shut it down. `bash` ignores this signal by +default and keeps the Minecraft server running. + +You must configure `bash` to [forward][forward-signal] the signal to properly +shutdown the Minecraft server as well. + +[sigterm]: https://en.wikipedia.org/wiki/Signal_(IPC)#SIGTERM +[forward-signal]: https://unix.stackexchange.com/a/434269/61092 + +## Example + +Here's a minimal example, trapping the signal and forwarding it to the server. +Be sure to set the correct server JAR file and appropriate memory limits. + +[`start-server`](../res/start-server): + +```bash +#!/bin/bash + +# Server JAR file, set this to your own +FILE=server.jar + +# Trap SIGTERM, forward it to server process ID +trap 'kill -TERM $PID' TERM INT + +# Start server +java -Xms1G -Xmx1G -jar $FILE --nogui & + +# Remember server process ID, wait for it to quit, then reset the trap +PID=$! +wait $PID +trap - TERM INT +wait $PID +``` diff --git a/docs/command_bash.md b/docs/command_bash.md deleted file mode 100644 index c6c4a77..0000000 --- a/docs/command_bash.md +++ /dev/null @@ -1,41 +0,0 @@ -# Use bash script to start server - -You may use a `bash` script to start your server rather than invoking `java` -directly. This requires some changes though to ensure your server properly shuts -down. - -When lazymc stops your server it sends a [`SIGTERM`][sigterm] signal to the -invoked server process to gracefully shut it down. `bash` ignores this signal by -default and keeps the Minecraft server running. - -You must configure `bash` to [forward][forward-signal] the signal to properly -shutdown the Minecraft server as well. - -[sigterm]: https://en.wikipedia.org/wiki/Signal_(IPC)#SIGTERM -[forward-signal]: https://unix.stackexchange.com/a/434269/61092 - -## Example - -Here's a minimal example, trapping the signal and forwarding it to the server. -Be sure to set the correct server JAR file and appropriate memory limits. - -[`start-server`](../res/start-server): - -```bash -#!/bin/bash - -# Server JAR file, set this to your own -FILE=server.jar - -# Trap SIGTERM, forward it to server process ID -trap 'kill -TERM $PID' TERM INT - -# Start server -java -Xms1G -Xmx1G -jar $FILE --nogui & - -# Remember server process ID, wait for it to quit, then reset the trap -PID=$! -wait $PID -trap - TERM INT -wait $PID -``` diff --git a/docs/command_bash.md b/docs/command_bash.md new file mode 120000 index 0000000..9ecdf48 --- /dev/null +++ b/docs/command_bash.md @@ -0,0 +1 @@ +command-bash.md \ No newline at end of file diff --git a/res/lazymc.toml b/res/lazymc.toml index d3cacc4..aca8809 100644 --- a/res/lazymc.toml +++ b/res/lazymc.toml @@ -30,7 +30,7 @@ directory = "." # Command to start the server. -# Warning: if using a bash script read: https://git.io/J1FvZ +# Warning: if using a bash script read: https://git.io/JMIKH command = "java -Xmx1G -Xms1G -jar server.jar --nogui" # Immediately wake server when starting lazymc.