How can I run commands from the server shell?


Recommended Posts

So far I wasn't able to find it out. All I've found is this:

"Added “-console” command line argument for dedicated servers, allows users to input lua commands directly from the application window."
http://forums.kleientertainment.com/topic/50615-update-126042-262015/

Not sure what it means tho.

And this:
"EDIT: The next build will have an optional console, for directly inputting commands in the Dedicated Server window."
http://forums.kleientertainment.com/topic/50262-admin-commands-not-working-on-dedicated-lan-only-server/?p=609568

If we just could find out what this window is. :D

Is there anybody who could provide a simple instruction how to run LUA commands directly from the host's shell/CLI *without* connecting to the server with the game-client?

Link to comment
Share on other sites

So, I guess I figured it out. Actually it's not that difficult, although I don't know how to use it with `screen`, because I'm using it with Docker.

First, you need to start the server on the CLI with the argument `-console` to enable this. Second, if you do so (without `screen`) you can simply input LUA code on the CLI, one command per line.

 

Using docker-compose with a docker-compose.yml file, it's important so set both, `tty` and `stdin_open`, to true. This enables to send commands to the running docker process, when reattaching to the container with `docker attach <container>`.

Unfortunately I don't know how to use this with `screen` but I guess it's also possible to attach back to the running process and enter commands.

Link to comment
Share on other sites

You can send commands directly to the screen session.

 

So, if you followed step 13 & 14 in the guide (titled, "[GUIDE] How to setup server dedicated cave on Linux"), dst_server1 is the name of the session used for the overworld, while dst_server2 is the screen session used for the cave.

 

To give player 1 forty logs in the outerworld, on the server, for example, you'd enter at your server:

 

screen -S dst_server1 -p 0 -X stuff "c_select(AllPlayers[1]) c_give(\"log\",40)$(printf "\r\n")"

 

This may not be the best way, but it works in Ubuntu Linux. 

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.