From: arasv@magtech.com.au
To: supervision@list.skarnet.org
Subject: Please review my Bluetooth run script
Date: Wed, 13 Aug 2008 20:48:50 +1000 (EST) [thread overview]
Message-ID: <1775.124.170.84.119.1218624530.squirrel@www.magtech.com.au> (raw)
Hi there,
I'm using the runit scripts in Busybox v1.11.1. I've pretty well moved
all my old init.d scripts over to the runit format and I'm very happy
with it.
I had a little bit of trouble with my Bluetooth Blue-Z startup script
but I have a working version.
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". I've managed to split the
old init.d script into a "run" and "finish" script. I also have a "down"
file so Bluetooth is only started when a BT dongle is added (triggered via
udev).
Here is my (simplified!) run script:
/etc # cat /etc/sv/bluetooth/run
#!/bin/sh
set -e
PATH=/sbin:/bin:/usr/sbin:/usr/bin
[ -e /etc/default/bluetooth ] && . /etc/default/bluetooth
# start all the Bluetooth services
hcid -f $HCID_CONFIG
sdpd
hidd $HIDD_OPTIONS --server || true
hid2hci --tohci > /dev/null 2>&1 || true
rfcomm -f $RFCOMM_CONFIG bind all || true
dund $DUND_OPTIONS
pand $PAND_OPTIONS
# now wait until we are told to finish by sv
trap 'exit 2' 1 2 3 15
exec sh -c "while [ 1 ]; do sleep 100; done"
exit 0
Here is the finish script:
/etc # cat /etc/sv/bluetooth/finish
#!/bin/sh
set -e
killall pppd > /dev/null 2>&1 || true
killall pand > /dev/null 2>&1 || true
killall dund > /dev/null 2>&1 || true
rfcommm release all > /dev/null 2>&1 || true
killall hidd > /dev/null 2>&1 || true
killall sdpd > /dev/null 2>&1 || true
killall hcid > /dev/null 2>&1 || true
exit 0
Does this seem reasonable?
Aras Vaichas
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
next reply other threads:[~2008-08-13 10:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 10:48 arasv [this message]
2008-08-13 12:05 ` Laurent Bercot
2008-08-14 1:37 ` Aras Vaichas
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=1775.124.170.84.119.1218624530.squirrel@www.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).