supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Please review my Bluetooth run script
@ 2008-08-13 10:48 arasv
  2008-08-13 12:05 ` Laurent Bercot
  0 siblings, 1 reply; 4+ messages in thread
From: arasv @ 2008-08-13 10:48 UTC (permalink / raw)
  To: supervision

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 
______________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-14  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-13 10:48 Please review my Bluetooth run script arasv
2008-08-13 12:05 ` Laurent Bercot
2008-08-14  1:37   ` Aras Vaichas
2008-08-14  9:47     ` Laurent Bercot

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).