<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 05/09/2024 15:52, Mantas Mikulėnas
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAPWNY8WRo1_1iKi9195gGh=K8bYZ_jN-+GkvRu0xNxQ2rEW68A@mail.gmail.com">
<p dir="ltr">FIFOs aren't sockets – they do not have an equivalent
to accept() and there is no multiplexing of inputs; all writes
to the FIFO immediately go to the "listening" file descriptor.
So it's almost more like a datagram socket than a stream one, in
a sense.</p>
<p dir="ltr">If you want a true socket that's filesystem-based,
create a Unix socket by specifying the path via ListenStream,
then connect to it using nc -U.</p>
<br>
</blockquote>
<p><br>
Yes writing the socket at:<br>
</p>
<p># emailoutput.socket<br>
[Unit]<br>
Description=Send email<br>
<br>
[Socket]<br>
ListenStream=%t/emailoutput.socket<br>
Accept=yes<br>
<br>
</p>
<p>Then things like <br>
<br>
echo "Hi There" | nc -U /run/emailout.socket<br>
<br>
work great and an instance of <a class="moz-txt-link-abbreviated" href="mailto:emailoutput@.service">emailoutput@.service</a> is created.<br>
<br>
Then the final thing I was trying to do was use that created
ListenStream that from another unit. e.g.<br>
<br>
[Unit]<br>
Description=Simple command<br>
<br>
[Service]<br>
ExecStart=/usr/bin/ls /etc/passwd /etc/notexisting<br>
StandardOutput=<a class="moz-txt-link-freetext" href="file:/run/emailoutput.socket">file:/run/emailoutput.socket</a><br>
StandardError=<a class="moz-txt-link-freetext" href="file:/run/emailoutput.socket">file:/run/emailoutput.socket</a><br>
<br>
A single email of Output and Error is generated - that's great -
thanks. <br>
</p>
<p>No more questions.<br>
</p>
<p>Steve.<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:CAPWNY8WRo1_1iKi9195gGh=K8bYZ_jN-+GkvRu0xNxQ2rEW68A@mail.gmail.com">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Sep 5, 2024, 13:38
Steve Traylen <<a href="mailto:steve.traylen@cern.ch" moz-do-not-send="true" class="moz-txt-link-freetext">steve.traylen@cern.ch</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Was
trying to set up a trivial socket and service to process
multiple <br>
inputs:<br>
<br>
# Socket emailoutput.socket<br>
[Unit]<br>
Description=Send email via a socket.<br>
<br>
[Socket]<br>
Accept=yes<br>
ListenFIFO=/run/emailoutput.socket<br>
<br>
# Service <a class="moz-txt-link-abbreviated" href="mailto:emailoutput@.service">emailoutput@.service</a><br>
[Unit]<br>
Description=email<br>
<br>
[Service]<br>
ExecStart=/usr/bin/mailx -s 'Testing from socket' <a href="mailto:steve@example.ch" target="_blank" rel="noreferrer" moz-do-not-send="true" class="moz-txt-link-freetext">steve@example.ch</a><br>
StandardInput=socket<br>
<br>
<br>
Starting the socket always produces: "Unit configured for
accepting <br>
sockets, but sockets are non-accepting. Refusing"<br>
<br>
Switching the socket to "ListenStream=<a href="http://127.0.0.1:9999" rel="noreferrer noreferrer" target="_blank" moz-do-not-send="true">127.0.0.1:9999</a>"
then everything <br>
works I can netcat files into the network socket.<br>
Is it impossible to to Accept=yes with ListenFIFO?<br>
<br>
<br>
Motivation for was this i wanted to do perform a systemd-run
of a <br>
command outputting to that socket to pipe it into mailx.<br>
<br>
<br>
</blockquote>
</div>
</blockquote>
</body>
</html>