Bedrock server should handle signals like SIGTERM and SIGINT for Linux like Java edition does. One of the benefits of doing that is that we can set bedrock server as a system service and it'll stop gracefully whenever the admin wants to stop the service or the system is shutting down.
Currently when it receives any of these signals it closes the server instantly without having the opportunity of cleaning up the server and it may lead to world corruption or worse.
Linked issues
Comments 5
In the meantime, you can wrap the server in a shell script to handle SIGTERM and shutdown the server gracefully by issuing a "stop" command. It ain't pretty, but it works...
Here's the dash script I use. (do not run with bash!)
set -e
pipe=/run/minecraft/pipe.$$
mkfifo $pipe
exec 3<> $pipe
rm $pipe
<&3 3>&- LD_LIBRARY_PATH=. ./bedrock_server & pid=$!
exec >&3 3<&-
trap 'echo stop' INT TERM
trap : CHLD
while read -r line; do echo $line; done
wait $pid
exit $?
Could a mod please link to BDS-203 and close this issue.
Could a mod please link to BDS-203 and close this issue.
Could a mod please link to BDS-203 and close this issue.
+1 on this. I believe SIGINT is already handled (Ctrl-C in terminal will log the "Quit correctly" message); however, SIGTERM is definitely NOT handled, and this makes dockerizing more difficult as well.