supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Aras Vaichas <arasv@magtech.com.au>
To: supervision@list.skarnet.org
Subject: Re: Please review my Bluetooth run script
Date: Thu, 14 Aug 2008 11:37:49 +1000	[thread overview]
Message-ID: <48A38C6D.9070204@magtech.com.au> (raw)
In-Reply-To: <20080813120505.GA11751@skarnet.org>

Laurent Bercot wrote:
>> What I want to know is if this is the "proper" way to go about it. The
>> original Blue-Z startup script starts quite a few daemons all at once,
>> and it kills off each of them with a "killall".
>>     
>
>  The original point of service supervision, what caused it to be
> implemented (with daemontools first, then with runit) in the first place,
> is that some daemons need to be automatically restarted if something
> somehow causes them to die.
>
>  Your current "run script" does not accomplish this.
>  It starts the various Bluetooth daemons, and kills them, just like a
> System V script would do. Those daemons are not supervised; what is
> supervised is actually the following script:
>
>    exec sh -c "while [ 1 ]; do sleep 100; done"
>
>  I'm sure you will agree that supervising this script isn't particularly
> useful. :)
>   
Oh yeah, I was never happy about that bit. The run script for the
bluetooth was a first-pass conversion from the Sys-V model. I used the
"mountd" run script as an example of starting multiple daemons from the
one place.

>  My advice would be to have separate services for hcid, sdpd, hidd,
> rfcommm (if it's a long-lived daemon), dund, pand and pppd. All those
> daemons need to be kept alive and running; as an additional benefit,
> you don't have to lose their logs by sending them to /dev/null, you
> can make use of runsv's logging facility to send each daemon's log
> into its own multilog or whatever your favorite logging system is.
>   
We're running an embedded Linux system, so I was trying to keep the
number of running processes to a minimum. I guess the runsv is fairly
light?

I think I will follow your advice and separate them.

As a side note, the logging could be handy during development, but we
don't keep any permanent logs because we run a flash filing system.

>  Then, once you have set up one service for each Bluetooth daemon
> that needs to be up, you can have a "bluetooth start" script that
> does a "sv up" on all those services at once, and a "bluetooth stop"
> script that does a "sv down" on them. And you can even control
> each daemon separately if the need arises.
>   
So are you recommending that I use a Sys-V script to start all the runsv
services?
e.g.
case "$1" in
  start)
    sv up hcid
    ...
    sv up sdpd
        ;;
  stop)
    sv down
     ...
    sv  down hcid
    ;;;
esac

Would I be able to use a runsv style of script to do this? Then I have
the same problem with "ending" the run script because the run script
doesn't end in a daemon process which is why I had the sleep loop in the
original run script.

I currently use UDEV to do an "sv up bluetooth" when the Bluetooth
device is inserted. I guess I could just as easily do "sv up hcid; sv up
sdpd; ... ".

No-one actually calls "sv down" because it's an embedded system with no
physical user interface, the services are only stopped when the device
is power cycled, which is fairly common and expected.

Aras

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________


  reply	other threads:[~2008-08-14  1:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-13 10:48 arasv
2008-08-13 12:05 ` Laurent Bercot
2008-08-14  1:37   ` Aras Vaichas [this message]
2008-08-14  9:47     ` 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=48A38C6D.9070204@magtech.com.au \
    --to=arasv@magtech.com.au \
    --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).