Closed RealityWinner closed 6 months ago
I have been working on this functionality for a week now and haven't manged to shut down the server in a way for it to save the game on stop. This is definitely something I want to add, if you manage to stop the server and get it to save, please go forward and create a pull request.
Wanted to follow up on this, did a bit of testing of this image and others and was not able to get it working in detached mode. The only successful scenario with interactive with tty. Which is really not the scenario I wanted because the entire point of a server is yea know a server. I'll update again if I ever figure anything out.
Please beware, if you are trying to work this out, that the server has to log the stop signal. If this happens, the server also saves the game. If it doesn't happen the server wil not save the game and simple stop.
I have tried many solutions and managed to get it to stop with a kill command. I haven't managed to stop the server with a docker stop command without external access. I have however found, that killing the process group will stop the server gracefully, I haven't managed to get this behaviour to work on exit with the entrypoint script.
Thank you for looking into this and please let me know if you stumble upon an option to make this work.
I have tried many solutions and managed to get it to stop with a kill command. I haven't managed to stop the server with a docker stop command without external access. I have however found, that killing the process group will stop the server gracefully, I haven't managed to get this behaviour to work on exit with the entrypoint script.
From what I understand of the docker stop
command it sends SIGINT to pid 1 entrypoint.sh. Using the below will correctly trap the command and pass it to the server process.
_sig () {
echo "Caught signal!"
kill -SIGINT $(pgrep VRisingServer)
}
trap _sig SIGINT
What command specifically have you found working for killing and saving? Does it work when you are running a server manually or via docker-compose up -d
?
May issue so far has been that, even though I am sending a SIGINT to the server process, it isn't saving and I don't know why.
Sending a SIGINT to the servers process group (with kill -INT -$(pgrep VRisingServer)
, when it's running under another bash process works, but I haven't managed to trigger the OnDestroy method of the server automatically with a trap.
Currently if you execute
docker stop
on the container it will be force killed after a timeout because signals are not correctly forwarded to the child VRisingServer.Prepending
exec
to the finalwine VRisingServer.exe
should be enough. I can test and submit a PR if desired. https://github.com/Mephi00/v-rising-wine-docker-image/blob/0ce5e7bf37be14e44b61172571b8632f2efd4d1a/entrypoint.sh#L99A more complex option is manually catching and forwarding it to the child process