TheRemote / Legendary-Bedrock-Container

Minecraft Bedrock dedicated server container featuring logging with timestamps, multiple server support, automated backups and more

Home Page:https://jamesachambers.com/legendary-minecraft-bedrock-container/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Container exits after container restart

grimholme opened this issue · comments

I'm attempting to get this running on a M1 mac mini.
The container appears to start and run the setup correctly on the first try and the minecraft server appears to be up and running (I haven't actually attempted to connect to it with a client yet).
The problem is if the container is stopped or restarted for any reason then the next time it tries to start it exits quickly with "Server is already started! Press screen -r minecraftbe to open it"
I tracked this down to a line ~30 in the start.sh file where it checks the "screen -list" for an already running screen. It appears that the previous screen hasn't cleared or timed out.
I added a "screen -wipe" right before the "screen -list" check which allows the container to restart.
I'm not sure if this is a valid fix.

Hey grimholme,

That makes sense. I'm not sure why I'm even checking for it in the container but I figured it wouldn't be a bad idea to leave that safety check there (I considered removing it and did remove a lot of stuff during the port that 100% for sure has no use in the container) even though it should theoretically be impossible for it to already be running in a container environment like this.

I'm glad I did because I like your solution better than removing the check for previous instances (who knows what kind of bugs this may catch later). Removing the check means that unlimited numbers of dead screens could theoretically pile up and never be seen.

This is genius because the screen -wipe command will only clear dead screens that should already be closed. If the server was actually running somehow (shouldn't be possible) that command wouldn't impact it and the check would actually successfully detect it's already running.

I'm going to implement this exactly as you described for these reasons. Thanks for reporting this!

EDIT: I actually put this in all 4 of my projects. The Bedrock and Java containers and the standalone Linux script versions of them. Thanks again!