Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container exits after container restart #2

Closed
grimholme opened this issue May 16, 2022 · 1 comment
Closed

Container exits after container restart #2

grimholme opened this issue May 16, 2022 · 1 comment

Comments

@grimholme
Copy link

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.

@TheRemote
Copy link
Owner

TheRemote commented May 16, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants