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: supervision@list.skarnet.org
Subject: Re: Configuration services
Date: Sun, 26 Jul 2009 19:07:35 +0200	[thread overview]
Message-ID: <20090726170735.GA13244@skarnet.org> (raw)
In-Reply-To: <20090726162204.GA19230@pretender.frop.net>

> Hi, does anyone use services that just set up some things but don't actually run a daemon?  This is hinted at http://smarden.org/pape/djb/daemontools/noinit.html.
> 
> Solaris does things like this with their SMF system and what they call "checkpoints".
> 
> I am doing this with runit by putting a while ./check; do; sleep 300; done; loop in the run script. Is there a better way?

 You can get rid of the shell for the 5 minutes of sleeping by letting
runit perform the loop itself. Your run script could look like:

#!/bin/sh
./check
exec sleep 300

or even better:

#!/command/execlineb -P
foreground { ./check }
sleep 300

 When sleep exits, the run script terminates, and runsv will automatically
start it again. No need for a loop inside your script. No need to keep the
shell around while the only thing to do is sleep.
 Additionally, you can decide to perform a ./check *now*, by sending a
SIGTERM to the service. (sv term)

 Bear in mind that all this is valid because you actually want to perform
an action regularly, which fits into the "service" model. (But if you are
using a crontab-like service on your system, you could also run your
regular check as a cron job or equivalent, and spare a service.)
 If you just want to set up some stuff *once*, and run no daemon, the
service model doesn't apply; write a script that does what you want and
just call it when needed (for instance at one-time system initialization),
don't try to keep it supervised.

-- 
 Laurent


  reply	other threads:[~2009-07-26 17:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-26 16:22 David Miller
2009-07-26 17:07 ` Laurent Bercot [this message]
2009-07-26 18:45   ` Charlie Brady
2009-07-26 21:10     ` David Miller
2009-07-27  8:56 ` Thomas Schwinge
2009-07-28  2:08   ` David Miller
2009-07-28  5:52     ` Laurent Bercot
2009-07-28 16:01       ` David Miller

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=20090726170735.GA13244@skarnet.org \
    --to=ska-supervision@skarnet.org \
    --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).