[systemd-devel] .service and .socket
Michael Chapman
mike at very.puzzling.org
Wed Jan 2 11:12:58 UTC 2019
On Wed, 2 Jan 2019, Reindl Harald wrote:
> Am 02.01.19 um 11:49 schrieb Michael Chapman:
> > On Wed, 2 Jan 2019, Reindl Harald wrote:
> > [...]
> >> agreed, but why can't have socket simply optional a [Service] section to
> >> save the "demo at .service" in cases like below?
> >>
> >> [root at client:/etc/systemd/system]$ cat demo.socket
> >> [Unit]
> >> Description=Demo Server - Activation Socket
> >>
> >> [Socket]
> >> Accept=yes
> >> ListenStream=0.0.0.0:7
> >> ListenStream=0.0.0.0:19
> >> ListenStream=0.0.0.0:21
> >>
> >> [Service]
> >> Type=oneshot
> >> ExecStart=/usr/bin/echo "DEMO-SERVICE"
> >> StandardOutput=socket
> >> StandardInput=socket
> >>
> >> [Install]
> >> WantedBy=sockets.target
>
> first can you please reply only to the list so that the duplicate
> message-filter don't rip the later coming list message after your
> off-list copy was received breaking my reply-to-list button and threading?
I'll try to remember, but I'm likely to forget. (I use Reply-all for much
the reasons described in [1]. I also prefer _receiving_ Reply-all emails,
since I've set up notifications when I receive personal email, but
not when I receive list email. You're lucky I'm keeping an eye on this
list at the moment, otherwise I probably wouldn't have seen your reply.
Mailman deduplicates the mail for me, so I never see duplicates.
Threading is fine since all the relevant headers are kept intact.)
[1] http://david.woodhou.se/reply-to-list.html
> > Presumably things in [Unit] would only apply to the socket. What if the
> > service needs [Unit] directives itself? Do we really want yet another
> > special case ("you can embed the service inside the socket... but only if
> > the service doesn't need [Unit] directives")?
>
> why would they need only apply to the socket?
Well, consider things like After= and Before=. Yes, you could make those
only apply to both the socket and the service, but it wouldn't make much
sense. In fact, they probably should only apply to the service.
But then you've got the special case that [Unit] directives inside a file
whose name matches *.socket don't apply to the socket, if and only if the
file also contains a [Service] section.
I would find that confusing.
> > I really don't think combining two units into one file makes things
> > simpler.
> well, all the 5 socket-activation units i ever wrote have besides
> ExecStart boilerplate stuff to make it a valid unit
I'm just looking on my system, and most of the socket-activated services
have their own other [Unit]-section directives in them (and not just
Description=).
More information about the systemd-devel
mailing list