thmhoag / arkserver

Docker image for a dedicated ARK Server with ArkManager.
MIT License
121 stars 43 forks source link

warn players before stopping the container #4

Closed catzoo closed 4 years ago

catzoo commented 4 years ago

I wasn't sure if everyone wanted this.

This pull request will add a --warn to the stop function. This will warn players when you're stopping the container, rather than stopping the whole server without a warning.

thmhoag commented 4 years ago

Hey @catzoo, I think a warning here would be great. However, not sure if we should use the --warn flag here.

The catch is, the --warn flag will delay the server stop by the arkwarnminutes specified in the arkmanager.cfg. Since this function is executing after catching a SIGTERM, that means a container stop has been requested (likely using docker stop or docker restart). By default, Docker will only wait 10s before killing the container. This can lead to an odd situation where players in the server would get a warning that a shutdown is occurring in "x minutes" (based on the arkwarnminutes setting) but then the container would abruptly get killed anyway after 10s.

I think what we could do here is add an arkmanager broadcast instead, just before executing arkmanager stop, notifying the players that an immediate shutdown was required. Maybe use an environment variable on the container to customize the message that would be sent.

catzoo commented 4 years ago

I see. I didn't know docker forced it to close after 10 seconds.

I removed --warn, added broadcast and notify. Doing both since broadcast will let the users know in the server and, notify will let the users in discord know the server shut down.

thmhoag commented 4 years ago

@catzoo fyi, this should be in the new thmhoag/arkserver:1.4.1 image. Thanks for the contribution!