daretmavi Posted January 22, 2022 Report Share Posted January 22, 2022 On my way to run VS Server on Raspberry Pi 4, I tried to run it through systemd. In works nice, but I was not able to send any commands to the server. Terminal emulation "screen" does not work with systemd, so the script server.sh is useless. I found some solution. It can be done by adding socket to the service definition (in /etc/systemd/system/). vintagestory.service [Service] ... Sockets=vintagestory.socket StandardInput=socket StandardOutput=journal StandardError=journal ... and create the socket file vintagestory.socket [Unit] PartOf=vintagestory.service [Socket] ListenFIFO=%t/vintagestory.stdin Now you can send the command with echo e.g. echo "/stats" > /run/vintagestory.stdin and read the server output with systemctl status vintagestory of look at the log sudo systemctl status vintagestory My service and socket files are attached (Work in progress). vintagestory.service vintagestory.socket 2 Link to comment Share on other sites More sharing options...
daretmavi Posted January 22, 2022 Author Report Share Posted January 22, 2022 Here is a simple script to run the command and get the status back - VS_command.sh VS_command.sh <COMMAND-FOR-SERVER> VS_command.sh Link to comment Share on other sites More sharing options...
Recommended Posts