supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Thomas Schwinge <schwinge-lists-skarnet.org-supervision@nic-nac-project.de>
Cc: supervision@list.skarnet.org
Subject: Re: Adding a 'setup' phase to service startup?
Date: Tue, 22 Feb 2005 16:06:01 +0100	[thread overview]
Message-ID: <20050222150601.GA28347@googlitzsch.de> (raw)
In-Reply-To: <421AB049.4040403@gmail.com>

On Mon, Feb 21, 2005 at 11:08:41PM -0500, Dean Hall wrote:
> 2) If all dependencies resolve, sysinit creates a lockfile for the
> service (separate from runit's) and starts it. (This is how service
> dependencies are resolved. Thus, a service is not considered started
> until all its dependencies are resolved and the service proper is
> actually running. This does not solve more fundamental race
> conditions--such as when a service starts but immediately fails, and
> another service checks its dependency in the short time in which the
> service is running--but I don't think those are solvable in any
> straightforward fashion, and I'm not sure if they should, as such race
> conditions indicate very severe problems that usually require human
> intervention.)

Just an idea:
What about using an executable '/service/S/status' that can be used by a
service R to check if the service S is working?
This executable's interface would have to be standardized, of course.
If '/service/S/status' is not executable, a default of
'svwaitup /service/S' could be used.

Example /service/sshd/status
#v+
#!/bin/sh

# exit 100 if the service can't be running.
if svok . ||
   runsvstat .
then :
else exit 100
fi &&

# exit 111 if the service might be running, but doesn't accept connections.
tcpclient -H -l 0 -R 127.0.0.1 22 true

# exit 0 if the service is accepting connections.
#v-

A service Q, depending on sshd (whatever that might be), could run
'cd /service/S && ./status' and use it's exit code to get aware of S's
status.
Of course, if that check is done from '/service/Q/run', Q will show up
as "running" at the time it is only checking if its dependencies are
met.
So, every service depending on Q's operativeness would have to check
'/service/Q/status' in turn...

Perhaps runsv could run e.g. '/service/Q/check' before execing into
'/service/Q/run'?
'/service/Q/check' could also make sure that Q is not restarted too
frequently (Thread "Respawn limit for runsv?").


> If anyone wants to talk to me about this privately, feel free to email
> me here. Or we can talk about it on the list if it's okay with Gerrit.

I'd say it's on topic here.
<URL:http://skarnet.org/lists.html>
#v+
* supervision: Discussion about system services, daemon supervision, init, runlevel management, and tools such as daemontools' svscan and supervise, or runit. 
#v-


Regards,
 Thomas


  reply	other threads:[~2005-02-22 15:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-21 17:41 Lars Kellogg-Stedman
2005-02-22  4:08 ` Dean Hall
2005-02-22 15:06   ` Thomas Schwinge [this message]
2005-02-23 20:07   ` Lars Kellogg-Stedman
2005-02-24  4:28     ` Dean Hall
2005-02-24  4:40     ` Dean Hall
2005-02-23 21:12 ` Stefan Karrmann
2005-03-07 11:56 ` Gerrit Pape

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=20050222150601.GA28347@googlitzsch.de \
    --to=schwinge-lists-skarnet.org-supervision@nic-nac-project.de \
    --cc=supervision@list.skarnet.org \
    /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;
as well as URLs for NNTP newsgroup(s).