Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Fiona Klute via buildroot <buildroot@buildroot.org>
Cc: Bernd Kuhls <bernd@kuhls.net>, Fiona Klute <fiona.klute@gmx.de>
Subject: Re: [Buildroot] [PATCH v2 0/6] Update init script style
Date: Sun, 14 Jul 2024 22:36:45 +0200	[thread overview]
Message-ID: <20240714223645.39adf8c6@windsurf> (raw)
In-Reply-To: <20240712124956.3925574-1-fiona.klute@gmx.de>

Hello Fiona,

On Fri, 12 Jul 2024 14:49:50 +0200
Fiona Klute via buildroot <buildroot@buildroot.org> wrote:

> Fiona Klute (WIWA) (6):
>   docs/manual: describe relying on default options
>   package/busybox: tidy up S01syslogd init script
>   docs/manual: include S01syslogd from source
>   package/openssh: tidy up init script
>   package/dnsmasq: tidy up init script
>   package/network-manager: rewrite init script

Thanks a lot for this, all are applied.

Now, when reviewing this and discussing with Arnout, we thought it
would be nice to have a little bit more documentation. Indeed, while
looking at the different init scripts in this series, we can identify 3
different cases:

- The S01syslogd case, where the daemon doesn't create a PID file, so
  we use --make-pidfile + --background so that start-stop-daemon
  creates the PID file and is in charge of daemonizing the daemon

  We use a loop with start-stop-daemon to check if the service has
  stopped

- The S80dnsmasq case, where the daemon creates its PID file, so we
  don't pass --make-pidfile + --background.

  But dnsmasq doesn't remove its PID file on stop, so we also use a
  start-stop-daemon loop to check if the service has stopped

- The S50sshd or S45NetworkManager cases, where the daemon creates its
  PID file, so we don't pass --make-pidfile + --background (same as
  S80dnsmasq)

  However, those daemons remove their PID file on stop, so we cannot
  use a start-stop-daemon loop, but instead loop until the PID file
  goes away

So essentially, the manual should have guidelines like this:

- If your service doesn't create its own PID file: invoke the daemon in
  foreground mode, and use start-stop-daemon --make-pidfile --background

  snippet of code

- If your service creates its own PID file: pass the --pidfile option
  to both start-stop-daemon *and the daemon itself so they agree on
  where the PID file is

  snippet of code

- If your service removes its PID file on shutdown, use a loop testing
  that the PID file has disappeared on stop, see S50sshd or
  S45NetworkManager for example:
 
  snippet of code

- If your service doesn't remove its PID file on shutdown, use a loop
  of start-stop-daemon, see S01syslogd for example:

  snippet of code

That would be *tremendously* useful to have in the documentation.

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      parent reply	other threads:[~2024-07-14 20:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-12 12:49 [Buildroot] [PATCH v2 0/6] Update init script style Fiona Klute via buildroot
2024-07-12 12:49 ` [Buildroot] [PATCH v2 1/6] docs/manual: describe relying on default options Fiona Klute via buildroot
2024-07-14 20:28   ` Thomas Petazzoni via buildroot
2024-07-12 12:49 ` [Buildroot] [PATCH v2 2/6] package/busybox: tidy up S01syslogd init script Fiona Klute via buildroot
2024-07-14 20:29   ` Thomas Petazzoni via buildroot
2024-07-12 12:49 ` [Buildroot] [PATCH v2 3/6] docs/manual: include S01syslogd from source Fiona Klute via buildroot
2024-07-14 20:29   ` Thomas Petazzoni via buildroot
2024-07-12 12:49 ` [Buildroot] [PATCH v2 4/6] package/openssh: tidy up init script Fiona Klute via buildroot
2024-07-14 20:29   ` Thomas Petazzoni via buildroot
2024-07-12 12:49 ` [Buildroot] [PATCH v2 5/6] package/dnsmasq: " Fiona Klute via buildroot
2024-07-14 20:30   ` Thomas Petazzoni via buildroot
2024-07-12 12:49 ` [Buildroot] [PATCH v2 6/6] package/network-manager: rewrite " Fiona Klute via buildroot
2024-07-14 20:30   ` Thomas Petazzoni via buildroot
2024-07-14 20:36 ` Thomas Petazzoni via buildroot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240714223645.39adf8c6@windsurf \
    --to=buildroot@buildroot.org \
    --cc=bernd@kuhls.net \
    --cc=fiona.klute@gmx.de \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox