b l a n k Posted July 2, 2024 Share Posted July 2, 2024 Hello, I start my server with this script: #!/bin/bash cluster_name="whatever" # Cluster's directory name dontstarve_dir="$HOME/.klei/DoNotStarveTogether" install_dir="$dontstarve_dir/.dontstarvetogether_dedicated_server" function fail() { echo Error: "$@" >&2 exit 1 } function check_for_file() { if [ ! -e "$1" ]; then fail "Missing file: $1" fi } check_for_file "$dontstarve_dir/$cluster_name/cluster.ini" check_for_file "$dontstarve_dir/$cluster_name/cluster_token.txt" check_for_file "$dontstarve_dir/$cluster_name/Master/server.ini" check_for_file "$dontstarve_dir/$cluster_name/Caves/server.ini" check_for_file "$install_dir/bin64" cd "$install_dir/bin64" || fail run_shared=(./dontstarve_dedicated_server_nullrenderer_x64) run_shared+=(-console) run_shared+=(-cluster "$cluster_name") run_shared+=(-monitor_parent_process $$) "${run_shared[@]}" -shard Caves | sed 's/^/Caves: /' & "${run_shared[@]}" -shard Master | sed 's/^/Master: /' Which is basically the recommended Klei's starting script file: https://accounts.klei.com/assets/gamesetup/linux/run_dedicated_servers.sh Once I launch the ./run_dedicated_servers.sh , whatever input I enter is ignored. I tried with c_announce("test") and c_shutdown(), I'm pretty sure nothing works. Does anyone else have this issue ? Thanks Link to comment https://forums.kleientertainment.com/forums/topic/157842-impossible-to-send-inputs-to-the-dedicated-server-gnulinux/ Share on other sites More sharing options...
chaosmonkey Posted July 3, 2024 Share Posted July 3, 2024 This is happening because the script is running the dst server as a sub process, and all of your input is being directed to bash, not dst. If you want to write to DST instead, you either need to set up a pipe or simply exec dst rather than call it. Link to comment https://forums.kleientertainment.com/forums/topic/157842-impossible-to-send-inputs-to-the-dedicated-server-gnulinux/#findComment-1731732 Share on other sites More sharing options...
b l a n k Posted July 4, 2024 Author Share Posted July 4, 2024 22 hours ago, chaosmonkey said: This is happening because the script is running the dst server as a sub process, and all of your input is being directed to bash, not dst. If you want to write to DST instead, you either need to set up a pipe or simply exec dst rather than call it. Yes I already thought that was the problem so I made some tests about it. Using the exec prefix on the last line (right behind ""${run_shared[@]}" -shard Master" ) doesn't fix the issue (my inputs get ignored the same). Sending the commands directly to the "dontstarve_dedicated_server_nullrenderer_x64" process' STDIN with some `echo "c_announce('test')" > /proc/PID/fd/0` doesn't work either (tried with both the Caves and Master shards). I failed to set up a mkfifo, I don't know how to do to make it work... Link to comment https://forums.kleientertainment.com/forums/topic/157842-impossible-to-send-inputs-to-the-dedicated-server-gnulinux/#findComment-1732193 Share on other sites More sharing options...
Daniel86268 Posted July 4, 2024 Share Posted July 4, 2024 You could try running the DST Server(s) in screen sessions like this: screen -S DSTMaster DST_MasterServer_Launch screen -S DSTCaves DST_CavesServer_Launch And then pass your comands to the screen sessions using screen -S DSTMaster -X YourCommand $'ls -l\n' screen -S DSTCaves -X YourCommand $'ls -l\n' For a Shutdown it would look like this for example (I think): screen -S DSTMaster -X c_shutdown() $'ls -l\n' screen -S DSTCaves -X c_shutdown() $'ls -l\n' Then again, the DST servers should receive the commands from the parent session thanks to the -monitor_parent_process $$ parameter. I could be wrong though... Link to comment https://forums.kleientertainment.com/forums/topic/157842-impossible-to-send-inputs-to-the-dedicated-server-gnulinux/#findComment-1732292 Share on other sites More sharing options...
b l a n k Posted July 4, 2024 Author Share Posted July 4, 2024 11 hours ago, Daniel86268 said: You could try running the DST Server(s) in screen sessions like this: screen -S DSTMaster DST_MasterServer_Launch screen -S DSTCaves DST_CavesServer_Launch And then pass your comands to the screen sessions using screen -S DSTMaster -X YourCommand $'ls -l\n' screen -S DSTCaves -X YourCommand $'ls -l\n' For a Shutdown it would look like this for example (I think): screen -S DSTMaster -X c_shutdown() $'ls -l\n' screen -S DSTCaves -X c_shutdown() $'ls -l\n' Then again, the DST servers should receive the commands from the parent session thanks to the -monitor_parent_process $$ parameter. I could be wrong though... That doesn't work, in fact I was already using screen, so I tried this first, before anything else. However, my command looked like this screen -S DST -X stuff "c_announce('test')^M" (the ^M is to simulate the Enter key, tried with and without) I also thought the -monitor_parent_process PID could be used to send command, but no success either. I must be doing something fundamentally wrong if you guys have success with those methods but I don't :/ Link to comment https://forums.kleientertainment.com/forums/topic/157842-impossible-to-send-inputs-to-the-dedicated-server-gnulinux/#findComment-1732452 Share on other sites More sharing options...
Daniel86268 Posted July 7, 2024 Share Posted July 7, 2024 Personally I usually always just run my DST Servers when I'm playing with friends, so I haven't run into this issue, but this could also be a workaround for you: Since you are already fiddling with screen, you can just do a screen -rx to reattach the screen session to your current console, and put the commands natively in there. If you have multiple screen sessions you can list the running screen sessions using screen -ls and reattach a specific screen session using screen -r <session ID> Like this: (Screenshot and individual commands taken from here) For automation it would be annoying/unusable, but if you want to manually announce something and/or shut down the server gracefully, this should work for now. Link to comment https://forums.kleientertainment.com/forums/topic/157842-impossible-to-send-inputs-to-the-dedicated-server-gnulinux/#findComment-1733495 Share on other sites More sharing options...
b l a n k Posted July 10, 2024 Author Share Posted July 10, 2024 Alright problem solved, I had "console_enabled = false" under "[MISC]" in my "cluster.ini" file. (Yes, I know...) Little did I know the "-console" parameter was actually deprecated. Thanks anyway guys, sorry for the trouble... And I confirm sending commands to the bash script works (probably thanks to the "-monitor_parent_process"), there is no need to use exec or pipes. Link to comment https://forums.kleientertainment.com/forums/topic/157842-impossible-to-send-inputs-to-the-dedicated-server-gnulinux/#findComment-1734428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.