Jump to content

Running commands in Master and Caves


Recommended Posts

I created my own dedicated server, all in one (I mean, the Master and Caves in same machine)

But there is a problem, when I run a command on steamCMD, the command runs randomly on Master or Caves, for example:

command:

c_announce("This is a message")


Result:

Caves:  [08:47:53]: [Announcement] This is a message
Master:  [08:47:53]: [Announcement] This is a message

My question:
is there a way to run the commands only on Master or Caves?

Link to comment
Share on other sites

You are probably using the predefined launch script widely used, which launches both shards in the same terminal. So all commands get forwarded to both servers. To have access to individual shards, you'd have to edit the launch script to only start a single shard, and then open a second terminal to launch the second shard.

For example:

The original script should have some text like this:


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: /'

 

The solution would be to edit the main script to look like this (Essentially just commenting the Caves launch line. This is only part of the script, there's stuff above, which you don't have to touch):


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: /'

and then write a second script that looks like this (This is the entire launch script, cause all the update stuff has been already handled by the Master shard script):

#!/bin/bash

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:  /' 

When you launch both individual launch scripts in individual terminals, you can access the Master shard from the first terminal (with the first/main script) and the Caves shard from the second terminal.

Link to comment
Share on other sites

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.

×
  • Create New...