Use consistent documentation file names

This commit is contained in:
timvisee
2021-11-25 13:51:24 +01:00
parent 93f75adc5c
commit 270362b152
3 changed files with 43 additions and 42 deletions

41
docs/command-bash.md Normal file
View File

@@ -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
```