binhex / arch-minecraftserver

Docker build script for Arch Linux base with Minecraft Java server
GNU General Public License v3.0
17 stars 27 forks source link

Server is not properly shutdown on docker restart/stop #12

Open CorneliusCornbread opened 2 years ago

CorneliusCornbread commented 2 years ago

I was doing some testing with a server status bot and it would post a message on when the server has stopped. Stopping the docker container does not cause the server to properly stop and abruptly shuts it down. This could lead to corrupted saves and loss of world data.

Rwarcards762 commented 1 year ago

I've been looking into this as well, for the same reason.

I've found some sort of workaround, where you can run something like

docker exec --user nobody binhex-minecraftserver screen -S minecraft -X stuff "stop^M"

which would send a "stop" command to the minecraft server. However, now I've run into an issue where it seems that doing this screen-stuffing gets a "permission denied" if the Web Terminal on port 8333 happens to be open at the same time. Can't track down if this is some sort of screen concurrent session permission weirdness, or if the Web Terminal takes over the session and locks out permissions while its connected.

I see -X stuff: permission denied pop up at the bottom of the web terminal if I run it while connected, and if I run the command while NOT connected to the Web Terminal it works correctly.

If anyone has an idea on how to resolve this permission error in screen in this incredibly specific case, definitely let me know 🙃