Page 1 of 1

Send commands to server from outside the game

Posted: Tue Mar 20, 2018 2:38 am
by noschang
Hi everyone!

I want to do something and can't figure out how.
I know that you can issue commands from the in-game console.

However, what I want is to issue commands from outside the game.
I will explain.

I have a headless server running on the background (detached from the Linux terminal).
I want to be able to send commands to the server using the terminal or from a shell script.

Something like this:

/opt/factorio/bin/x64/factorio --send-command "/c game.player.force.manual_mining_speed_modifier=1000"

I've heard/read something about RCON.
But I don't know what RCON is and don't have any idea of how to use it.

Any help would be appreciated.
Thanks!

Re: Send commands to server from outside the game

Posted: Thu Mar 22, 2018 4:51 pm
by noschang
Hi everyone!

I found out how to accomplish the desired behavior.
In linux, this is possible using a special "fifo" file.

You use the "mkfifo" tool to create a file that will be used as a bridge between the server process and the other processes.
No time to explain here with details, but basically after creating the file if you write on it, the content is redirected to the server process pipe.

Here is an service script for factorio that uses this strategy:
https://github.com/Bisa/factorio-init/b ... r/factorio

Anyway, thanks everybody.