docker-minecraft-server icon indicating copy to clipboard operation
docker-minecraft-server copied to clipboard

auto-restart feature

Open atfrase opened this issue 2 years ago • 3 comments

Enhancement Type

A completely new feature

Describe the enhancement

It would be great to have some options for the server to automatically restart itself under configurable conditions: i.e. no users connected in the last X minutes (similar to the autopause condition), last started more than Y hours ago, only inside a certain time window, etc. When combined with SPIGET_RESOURCES this would also facilitate easier automatic updating of highly version-sensitive plugins such as Geyser, ViaVersion, or ViaBackwards.

atfrase avatar Jan 22 '23 17:01 atfrase

The requested feature is very difficult to implement fully within the scope of the container. The auto-stop feature

https://github.com/itzg/docker-minecraft-server#autostop

was implemented as a compromise assuming the container had been declared with an appropriate restart policy.

itzg avatar Jan 22 '23 19:01 itzg

Yeah, lots of that intricate stuff is hard to get from at the container level, ie number of players online. A while ago I was using this plugin on Paper and just had my container configured to restart unless-stopped and didn't provide a restart script to the plugin and it worked perfectly.

You could theoretically send the list command to the server when it wanted to restart, process the output then restart if able to, but that sounds janky and I don't know if it would make directly interfacing with the server console messy.

EDIT: after digging around actually how this container works, you could probably write a wrapper and use mc-monitor

caitlynrw avatar Feb 12 '23 05:02 caitlynrw

Yeah, "very difficult" == still quite doable 😀 I could see https://github.com/itzg/mc-server-runner/issues/19 being a part of what could feed into this logic.

itzg avatar Feb 12 '23 13:02 itzg