<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <br>
    <div class="moz-cite-prefix">On 02/01/2019 07:31, Michael Chapman
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:alpine.LFD.2.21.1901021727400.4053@beren.home">
      <pre class="moz-quote-pre" wrap="">On Tue, 1 Jan 2019, Olaf van der Spek wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Hi,

AFAIK socket units require a separate file, which seems more complex
then it has to be.

1. Could sockets be specified directly in the .service file?
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
If anything, I should think it would work the other way around: a .socket 
without any activatable .service is relatively useless.

But I'm not proposing that this actually be implemented.</pre>
    </blockquote>
    A socket can trigger a service with a different name using Service=<br>
    <br>
    moreover a service can be triggered by multiple sockets. It's a bit<br>
    complicated to use (check Socket= in [Service]) but it can be handy<br>
    if you want your web server to be started both by 80 and 8080<br>
    <blockquote type="cite"
      cite="mid:alpine.LFD.2.21.1901021727400.4053@beren.home">
      <pre class="moz-quote-pre" wrap="">

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">2. If not, could the .service file gain a default / implicit
dependency on the .socket file?
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
There are a some reasons for not having a .service dependent upon its 
.socket. Many services can be started directly and will work correctly 
even when not passed any sockets from systemd.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">3. AFAIK Install.WantedBy doesn't have a default. Could it get a proper default?
</pre>
      </blockquote>
    </blockquote>
    WantedBy is valid for all units, not just services and can have lots
    of proper values, not just <br>
    default.target.<br>
    <br>
    Lots of on demand daemons do not have a WantedBy at all. they have
    Also=<a trigger unit><br>
    <br>
    <blockquote type="cite"
      cite="mid:alpine.LFD.2.21.1901021727400.4053@beren.home">
      <pre class="moz-quote-pre" wrap="">
That doesn't make much sense.

Take your example:

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">xhp.service:
[Unit]
Requires=xhp.socket

[Install]
WantedBy=default.target

xhp.socket:
[Socket]
ListenStream=/run/xhp.socket
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
This would start xhp.service at daemon startup (i.e. boot, for the system 
daemon) whether or not the service is actually required. One of the 
reasons for using socket activation is to _not_ start services when 
they're not required.
_______________________________________________
systemd-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a>
</pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <div>
        <link href="https://fonts.googleapis.com/css?family=Raleway"
          rel="stylesheet" type="text/css">
        <font face="Raleway, regular">
          <table style="padding:20px;margin-bottom:-10px" border="0">
            <tbody>
              <tr>
                <td style="font-size:13px; color:#ff8054; text-align:
                  center; padding-right:30px"> <a
                    href="http://www.smile.eu/"> <img
                      style="max-width:100%; height:auto"
src="http://ftp.smile.fr/client/Communication/signature/img/Logo-new.png"
                      alt="SMILE"> </a><br>
                  <br>
                  <p style="line-heigth:8px">20 rue des Jardins<br>
                    92600 Asnières-sur-Seine</p>
                </td>
                <td style="border-left: 1px solid #3b7ffe;
                  padding-left:20px; font-size:13px; color:#ff8054;">
                  <div style="color:#ff8054; font-size:14px;"> <b>Jérémy
                      ROSEN</b> </div>
                  <div style="color:#3b7ffe; font-size:13px;">
                    Architecte technique<br>
                    Responsable de l'expertise Smile-ECS </div>
                  <br>
                  <div style="color:#3b7ffe; font-size:13px;"> <span
                      style="white-space: nowrap"><img
                        style="margin-right:5px"
                        src="http://ftp.smile.fr/client/Communication/signature/img/mail.png"
                        alt="email" width="12" height="10"> <a
                        href="mailto:jeremy.rosen@smile.fr"
                        style="color:#3b7ffe; font-size:13px;
                        text-decoration:none;">jeremy.rosen@smile.fr</a>
                    </span> <br>
                    <span style="white-space: nowrap"><img
                        style="margin-right:5px"
                        src="http://ftp.smile.fr/client/Communication/signature/img/phone.png"
                        alt="phone" width="10" height="10"></span>
                    +33141402967 <br>
                    <span style="white-space: nowrap"><img
                        style="margin-right:5px"
                        src="http://ftp.smile.fr/client/Communication/signature/img/web.png"
                        alt="url" width="12" height="12">
                      <a href="http://www.smile.eu"
                        style="color:#3b7ffe; font-size:13px;
                        text-decoration:none;">http://www.smile.eu</a> </span>
                  </div>
                  <br>
                  <div> <span><a style="margin-right:5px"
                        href="https://twitter.com/GroupeSmile"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-twitter.png"
                          alt="Twitter" style="max-width:100%;
                          height:auto"></a></span> <span><a
                        style="margin-right:5px"
                        href="https://www.facebook.com/smileopensource"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-facebook.png"
                          alt="Facebook" style="max-width:100%;
                          height:auto"></a></span> <span><a
                        style="margin-right:5px"
                        href="https://www.linkedin.com/company/smile"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-linkedin.png"
                          alt="LinkedIn" style="max-width:100%;
                          height:auto"></a></span> <span><a
                        style="margin-right:5px"
                        href="https://github.com/Smile-SA"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-github.png"
                          alt="Github" style="max-width:100%;
                          height:auto"></a></span> </div>
                </td>
              </tr>
            </tbody>
          </table>
          <br>
          <div> <a
href="http://smile.eu/?utm_source=signature&utm_medium=email&utm_campaign=signature"><img
src="http://signature.smile.eu/assets/img/bandeau_mail_smile2017.gif.gif"
                alt="Découvrez l’univers Smile, rendez-vous sur
                smile.eu" border="0"></a></div>
          <br>
          <div style="color:#a3acb5; font-size:10px;"> <img
              src="http://ftp.smile.fr/client/Communication/signature/img/eco.png"
              alt="eco" width="13" height="11"> Pour la planète,
            n'imprimez ce mail que si c'est nécessaire </div>
        </font>
      </div>
    </div>
  </body>
</html>