I'm currently trying to make a systemd service with two Fifo sockets. These sockets map to stdout and stdin of the application. I'm currently using the following configuration files.
foo.service
[Unit]
Description=foo Fifo test
After=network.target foo-in.socket foo-out.socket
Requires=foo-in.socket foo-out.socket
[Service]
Sockets=foo-out.socket
Sockets=foo-in.socket
StandardOutput=fd:foo-out.socket
StandardInput=fd:foo-in.socket
StandardError=journal
ExecStart=/path/to/foo/exec
foo-out.socket
[Unit]
Description=foo Task Writes to this
[Socket]
Service=foo.service
ListenFIFO=%t/foo/out
foo-in.socket
[Unit]
Description=foo Task reads commands from this
[Socket]
Service=foo.service
ListenFIFO=/run/user/1000/foo/in
I can start the service using the commands systemctl --user daemon-reload
and systemctl --user start foo
. The problem comes when I try stopping foo.service. I receive this message:
Warning: Stopping foo.service, but it can still be activated by:
foo-in.socket
foo-out.socket
Is there a way to stop the sockets automatically when the service is stopped?
Wants
both sockets, which are bothPartOf
the target. Then you can manage the whole thing using the target, rather than the service.