You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This isn't an issue so much as a help request. I am starting my server using systemd, but want to be able to cleanly close it without attaching to the docker session and sending 'c_shutdown()'. You can't do a simple docker exec because it's part of an interactive shell, not a direct command. I found this possible solution, so I sent:
echo"c_shutdown()"| docker attach dst_master
But I get the error:
the input device is not a TTY
I'm not familiar with docker, is there another way I can pipe the command into the session?
The text was updated successfully, but these errors were encountered:
Hey @Molorius I tried some ideas but unfortunately didn't manage to make it work. I remember this is something I wanted to implement long ago, i.e. create a stop.sh script that would do a clean shutdown saving the game, but never got it to work.
docker attach seems a bit limited as it works only in a very specific way (interactively). Tried with docker exec, which spawns another process in the container (e.g. another bash), but couldn't attach tty or send the c_shutdown() signal to the running proccess, dontstarve_dedicated_server_nullrenderer.
What I usually do when playing is to manually shut it down if I'm the last player to leave through the game console directly. It's still a manual process, but quicker.
Let's leave the issue open, if we ever come around a solution we can share it here as I believe more people would benefit from it 🤓
By putting that in a "my_shutdown.sh" script, I also got a working systemd file:
[Unit]
Description=Don't Starve Together Server
After=docker.service
After=network.service
[Service]
Type=oneshot
RemainAfterExit=yes
User={user you want starting this container}
WorkingDirectory={your working directory here}
ExecStart=docker-compose up -d
ExecStop=/bin/bash my_shutdown.sh
[Install]
WantedBy=multi-user.target
Host OS: Arch Linux
Local Computer
This isn't an issue so much as a help request. I am starting my server using systemd, but want to be able to cleanly close it without attaching to the docker session and sending 'c_shutdown()'. You can't do a simple
docker exec
because it's part of an interactive shell, not a direct command. I found this possible solution, so I sent:But I get the error:
I'm not familiar with docker, is there another way I can pipe the command into the session?
The text was updated successfully, but these errors were encountered: