Skip to content

Instantly share code, notes, and snippets.

@bewest
Created January 11, 2016 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bewest/df3df42926b73fc4f4eb to your computer and use it in GitHub Desktop.
Save bewest/df3df42926b73fc4f4eb to your computer and use it in GitHub Desktop.
# bluez - bluetooth daemon
description "bluetooth daemon"
start on started dbus
stop on stopping dbus
env UART_CONF=/etc/bluetooth/uart
env RFCOMM_CONF=/etc/bluetooth/rfcomm.conf
# expect fork
# expect daemon
respawn
exec /usr/sbin/bluetoothd -E
post-start script
[ "$VERBOSE" = no ] && redirect='>/dev/null 2>&1' || redirect=
# start_uarts()
if [ -x /usr/sbin/hciattach ] && [ -f $UART_CONF ];
then
grep -v '^#' $UART_CONF | while read i; do
eval "/usr/sbin/hciattach $i $redirect" || :
done
fi
# start_rfcomm()
if [ -x /usr/bin/rfcomm ] && [ -f $RFCOMM_CONF ] ;
then
# rfcomm must always succeed for now: users
# may not yet have an rfcomm-enabled kernel
eval "/usr/bin/rfcomm -f $RFCOMM_CONF bind all $redirect" || :
fi
end script
post-stop script
# stop_uarts()
logger -t bluez "Stopping uarts"
killall hciattach >/dev/null 2>&1 || :
# stop_rfcomm()
logger -t bluez "Stopping rfcomm"
if [ -x /usr/bin/rfcomm ];
then
eval "/usr/bin/rfcomm unbind all $redirect" || :
fi
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment