#!/bin/sh
#
# Starts bluetoothd
#

start() {
	printf "Starting bluetoothd: "
	umask 077

	start-stop-daemon -S -b -q -p /var/run/bluetoothd.pid \
		--exec /usr/libexec/bluetooth/bluetoothd
	[ $? = 0 ] && echo "OK" || echo "FAIL"
}
stop() {
	printf "Stopping bluetoothd: "
	start-stop-daemon -K -q -p /var/run/bluetoothd.pid
	[ $? = 0 ] && echo "OK" || echo "FAIL"
}
restart() {
	stop
	start
}

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart|reload)
  	restart
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $?
