[systemd-devel] Service activation

Michael Biebl mbiebl at gmail.com
Sun Feb 13 16:42:15 UTC 2022


Am So., 13. Feb. 2022 um 17:01 Uhr schrieb Wols Lists
<antlists at youngman.org.uk>:
>
> On 13/02/2022 15:46, Mantas Mikulėnas wrote:
> > On Sun, Feb 13, 2022 at 1:09 PM Wols Lists <antlists at youngman.org.uk
> > <mailto:antlists at youngman.org.uk>> wrote:
> >
> >     On 13/02/2022 09:54, Mantas Mikulėnas wrote:
> >      > On Sun, Feb 13, 2022 at 2:03 AM Wol <antlists at youngman.org.uk
> >     <mailto:antlists at youngman.org.uk>
> >      > <mailto:antlists at youngman.org.uk
> >     <mailto:antlists at youngman.org.uk>>> wrote:
> >      >
> >      >     More fun getting things to work ... :-)
> >      >
> >      >     So I've got a service, scarletdme.service, which fires up my
> >     db backend
> >      >     for running interactively. However, I also need a socket
> >     service for
> >      >     remote connections.
> >      >
> >      >     I've got the xinetd files, but if I'm running systemd, I want
> >     to use
> >      >     systemd :-)
> >      >
> >      >     So I've written scarletdme.socket, and scarletdme at .service,
> >     but the
> >      >     more
> >      >     I read, the more I don't understand ...
> >      >
> >      >     Do I enable scarletdme.socket the same as anything else eg
> >     "systemctl
> >      >     enable scarletdme.socket"? How does it know the difference
> >     between
> >      >     scarletdme.service and scarletdme at .service? I get the
> >     impression I need
> >      >     to put something in the .socket file to make it use
> >     scarletdme@ rather
> >      >     than scarletdme?
> >      >
> >      >
> >      > If it's a 'nowait' socket (which is "[Socket] Accept=yes" in systemd
> >      > terms), then it will use the templated @.service, starting a new
> >      > instance for each "accepted" socket (i.e. instance per
> >     connection). See
> >      > oidentd.socket for comparison.
> >      >
> >      > Otherwise (by default) it uses the non-templated service and
> >     directly
> >      > gives it the "listening" socket, letting the service itself
> >     handle accept().
> >      >
> >     ??? Sorry, that's double dutch to me.
> >
> >     Are you telling me that just copying the files into /lib/systemd/system
> >     will enable them? That seems weird to me because it doesn't do it for
> >     normal services afaik. (Or shouldn't I be copying it direct into
> >     /lib/systemd/system? I just don't know ...)
> >
> >
> > No, I was not talking about any of that. You asked how systemd knows the
> > difference between dme.service and dme at .service.
>
> Let's rewind a moment. That was my SECOND question. That's one of the
> reasons I got confused, because my FIRST question WAS "how do I start
> scarletdme.socket?"
>
> So the answer to that is nice and simple,
> "systemctl enable/start scarletdme.socket"

no, you start a socket by "systemctl start". You enable a socket,
service, unit,... via "systemctl enable"

enable and start are different concepts.

> Now what I don't want is for scarletdme.socket to invoke
> scarletdme.service. How do I tell it that it is supposed to invoke
> scarletdme at .service? Or have I messed up naming conventions? Or what the
> hell is the proper way to do it?

Please read again what Mantas wrote. He explained all that rather nicely.


More information about the systemd-devel mailing list