The following socat command-line works as expected when entered at a shell prompt:
# /usr/bin/socat UDP-RECV:4321 STDOUT
It listens on UDP port 4321 and writes everything received to standard output.
The following is an attempt at starting this command as a systemd service with the intention that it writes received data to the systemd journal (the default destination for a service's standard output):
# /etc/systemd/system/socat.service [Service] ExecStart=/usr/bin/socat UDP-RECV:4321 STDOUT
However, socat exits immediately when this service is started:
Process: 7425 ExecStart=/usr/bin/socat UDP-RECV:4321 STDOUT (code=exited, status=0/SUCCESS)
Researching the problem (running
-d -d -d -d) revals that it's getting an EOF on standard output:
N starting data transfer loop with FDs [5,5] and [1,1] N socket 2 (fd 1) is at EOF I close(5) N exiting with status 0
Is it possible to use
socat as a systemd service?