<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <p>Michael Biebl:</p>
    <blockquote type="cite">
      <p>If other services depend on dnsmasq, please keep
        <a class="moz-txt-link-freetext" href="https://www.lucas-nussbaum.net/blog/?p=877">https://www.lucas-nussbaum.net/blog/?p=877</a> in mind</p>
    </blockquote>
    <p>Please do not.  It is an erroneous conclusion based upon a faulty
      analysis that conflates the <a
        href="http://jdebp.eu./FGA/unix-daemon-readiness-protocol-problems.html">readiness
        protocols</a> with <a
href="http://jdebp.eu./Softwares/nosh/bsd-service-command.html#Background">the
        non-daemon nature of the way that things are run by the <code>service</code>
        command</a> with the van Smoorenburg system, falsely attributing
      the output behaviour caused by the latter to the former.</p>
    <p>The correct approach follows this maxim:</p>
    <p>If the many years of pressure have led to a program having a way
      to run under daemontools, and that is even documented right there
      in the program's manual page, then that is also very likely the
      best way to run it under systemd, too.  The requirements that the
      systemd people put forward for what they naïvely call "new-style
      dæmons" are in fact <i>the same</i> behaviours that the
      daemontools world has lobbied for for the past couple of decades
      (and has fairly widely succeeded in obtaining over that time), and
      that IBM was setting out fast approaching a quarter of a century
      ago.</p>
    <p>* <a
        href="http://jdebp.eu./FGA/unix-daemon-design-mistakes-to-avoid.html"><a class="moz-txt-link-freetext" href="http://jdebp.eu./FGA/unix-daemon-design-mistakes-to-avoid.html">http://jdebp.eu./FGA/unix-daemon-design-mistakes-to-avoid.html</a></a></p>
    <p>That is the case here, using the daemontools mode is how to
      address this problem, and the original service unit file (in <code>contrib/systemd/</code>)
      did in fact get this right:</p>
    <br>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <tt>--- systemd.service.original    2018-02-07 19:44:24.000000000
      +0000</tt><tt><br>
    </tt><tt>+++ systemd.service    2018-02-07 19:58:36.307113285 +0000</tt><tt><br>
    </tt><tt>@@ -6,8 +6,10 @@<br>
       After=network.target<br>
       <br>
       [Service]<br>
      -Type=forking<br>
      -PIDFile=/run/dnsmasq/dnsmasq.pid<br>
      +Type=simple<br>
      +RuntimeDirectory=dnsmasq<br>
      +RuntimeDirectoryMode=0755<br>
      +ExecStartPre=/bin/chown dnsmasq:nogroup %t/dnsmasq<br>
       <br>
    </tt><tt> # Test the config file and refuse starting if it is not
      valid.</tt><tt><br>
    </tt><tt>--- init.original    2018-02-07 19:44:24.000000000 +0000</tt><tt><br>
    </tt><tt>+++ init    2018-02-07 20:06:25.215113285 +0000</tt><tt><br>
    </tt><tt>@@ -292,13 +292,8 @@</tt><tt><br>
    </tt><tt>     stop_resolvconf</tt><tt><br>
    </tt><tt>     ;;</tt><tt><br>
    </tt><tt>   systemd-exec)</tt><tt><br>
    </tt><tt>-# /run may be volatile, so we need to ensure that</tt><tt><br>
    </tt><tt>-        # /run/dnsmasq exists here as well as in postinst</tt><tt><br>
    </tt><tt>-        if [ ! -d /run/dnsmasq ]; then</tt><tt><br>
    </tt><tt>-           mkdir /run/dnsmasq || return 2</tt><tt><br>
    </tt><tt>-           chown dnsmasq:nogroup /run/dnsmasq || return 2</tt><tt><br>
    </tt><tt>-        fi</tt><tt><br>
    </tt><tt>-    exec $DAEMON -x /run/dnsmasq/$NAME.pid \</tt><tt><br>
    </tt><tt>+      # systemd's mechanisms handle the runtime directory.</tt><tt><br>
    </tt><tt>+    exec $DAEMON --keep-in-foreground \</tt><tt><br>
    </tt><tt>         ${MAILHOSTNAME:+ -m $MAILHOSTNAME} \</tt><tt><br>
    </tt><tt>         ${MAILTARGET:+ -t $MAILTARGET} \</tt><tt><br>
    </tt><tt>         ${DNSMASQ_USER:+ -u $DNSMASQ_USER} \</tt><tt><br>
    </tt><br>
  </body>
</html>