-
-
Notifications
You must be signed in to change notification settings - Fork 28
Description
- Many games have mods that let an admin trigger a shutdown such as "15 minutes until shutdown. Please log out...".
- After 15 minutes, the game itself shuts off the server.
- But because LinuxGSM's docker images have a HEALTHCHECK line that runs the
monitorcommand endlessly every minute, it will detect that the server has shut down and will start itself again. - Therefore LinuxGSM prevents the game from shutting itself down and interrupts a common scenario (servers that shut themselves down with a timer/warning).
This is only fixable by improving the containers to have a /tmp killswitch for the health monitor externally. Like this:
Dockerfileexample:
HEALTHCHECK CMD [ "/bin/sh", "-c", "[ -f /tmp/disable-monitor ] || curl -f http://localhost/health" ]- How to kill such a healthcheck monitor externally:
podman exec sdtdserver touch /tmp/disable-monitorAnd because it's in /tmp it will vanish when the container starts up the next time.
In LinuxGSM's case, that type of logic would have to be added to this file instead:
https://github.com/GameServerManagers/docker-linuxgsm/blob/main/entrypoint-healthcheck.sh
Basically adapt that file to not do a "monitor" check if /tmp/disable-monitor exists.
Do NOT exit 0 (or exit 1) if that file exists. Simply skip the health check. Because otherwise, the "disabled" healthcheck itself would trigger an instant container shutdown every minute, which is not correct.
Instead, simply skip it, perhaps echoing a log message saying that health monitor is disabled and being skipped.
After that, the server will simply sit in a shutdown state and the health check will do nothing. The server admin then "simply" has to stop the container itself after that state has been reached.
If LinuxGSM supports a feature like this, I would then be able to just add that command to the same script that sends the "15 minute shutdown" command to the server itself. Then the game would take care of shutting down, and the monitor would not restart the game anymore. After the server itself has shut itself down, I would just have to manually stop the container as usual.
Next time I start the container again, the health check would be running as usual again (since /tmp is a tmpfs and isn't preserved).
This is the solution.