supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: "Laurent Bercot" <ska-supervision@skarnet.org>
To: "Steve Litt" <slitt@troubleshooters.com>, supervision@list.skarnet.org
Subject: Re: S6 Queries
Date: Mon, 02 Aug 2021 19:39:47 +0000	[thread overview]
Message-ID: <em53404023-b5de-45d0-aad2-18dd54e8a436@elzian> (raw)
In-Reply-To: <20210802140732.316b9f4d@mydesk.domain.cxm>

>I thought the way to do what the OP asked is:
>
>=============================
>#!/bin/sh
>s6-svc -u myrequirement || exit 1
>exec mydaemon -myarg1 -myarg2
>=============================

  This is not a good idea in a s6-rc installation, because it sends
raw s6 commands, which may mess with the service state as viewed by
s6-rc. Also, it sends control commands to a service from another
service's run script, which is bad form in general: it is
unintuitive that starting the mydaemon service also causes the
myrequirement service to be started. Dependencies should be handled at
the service manager level, not at the process supervision level.

  Of course, you can do that in a pinch for small s6-only installations,
where you have no proper dependency engine, but that does not seem to be
what the OP is asking.

  And even then, this does not implement After= because s6-svc -u
returns instantly. This only implements Wants=. To implement After=,
you would need something like s6-svc -uwU instead, which is not good
because it adds the myrequirement readiness delay to the mydaemon
readiness delay, so if mydaemon has strict readiness timeouts, it
can make it fail.

  All in all, it's better to avoid controlling another service in a run
script: there's always an annoying corner case somewhere. Dependency
management is best handled by the external tool that is explicitly
supposed to do it: the service manager.

--
  Laurent


  reply	other threads:[~2021-08-02 19:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02  4:54 Arjun D R
2021-08-02  8:27 ` Laurent Bercot
2021-08-02 18:07   ` Steve Litt
2021-08-02 19:39     ` Laurent Bercot [this message]
2021-08-02 20:42       ` Steve Litt
2021-08-02 21:40         ` Laurent Bercot
2021-08-11 11:05   ` Arjun D R
2021-08-11 14:21     ` Laurent Bercot

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=em53404023-b5de-45d0-aad2-18dd54e8a436@elzian \
    --to=ska-supervision@skarnet.org \
    --cc=slitt@troubleshooters.com \
    --cc=supervision@list.skarnet.org \
    --subject='Re: S6 Queries' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).