Jump to content

[Linux] VS Server with systemd


daretmavi
 Share

Recommended Posts

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

  • Thanks 2
Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.