I have a program running under a systemd service and I'd like to pass some text/commands to it, so I tried doing so with a FIFO file:
.service file
.service file
[Unit]
Description=A Minecraft server service!
[Service]
EnvironmentFile=/etc/systemd/system/minecraft.env
WorkingDirectory=/srv/http/mc/mcserver/
ExecStart=/srv/http/mc/mcserver/start minecraft_input or
echo 'stop (or anything)' | tee minecraft_input)` it just hangs with no output and nothing gets passed. (FIFO File created using mkfifo and has permissions 664)
EDIT:
I accidentally pasted the wrong code. I also tried this:
.service file
[Unit]
Description=A Minecraft server service!
Requires=minecraft.socket
[Service]
EnvironmentFile=/etc/systemd/system/minecraft.env
WorkingDirectory=/srv/http/mc/mcserver/
ExecStart=/srv/http/mc/mcserver/start
StandardOutput=append:/srv/http/mc/mcserver/mcserver.log
StandartInput=socket
[Install]
WantedBy=multi-user.target
.socket file
[Socket]
ListenFIFO=/srv/http/mc/mcserver/minecraft_input
Service=minecraft.service
[Install]
WantedBy=sockets.target
```
But that doesn't work either. The echo command completes, but nothing happens/passes to the program.
Asked by slavekrouta
(1 rep)
Dec 2, 2024, 06:39 PM
Last activity: Dec 6, 2024, 08:44 AM
Last activity: Dec 6, 2024, 08:44 AM