#!/bin/sh
#
# Start/stop bluetoothd
#
# NOTE: bluetoothd also can be started automatically by
# D-Bus on connection to "org.bluez" (if it's not started yet).
# See /usr/dbus-1/system-services/org.bluez.service
#

SERVICE=bluetoothd
DAEMON="/usr/libexec/bluetooth/$SERVICE"

case "$1" in
start)
  echo "Starting $SERVICE..."
  start-stop-daemon -S -b -x "$DAEMON" -n "$SERVICE" -- -E -d
  ;;
stop)
  echo "Stopping $SERVICE..."
  start-stop-daemon -K -x "$DAEMON" -n "$SERVICE" -o
  ;;
restart)
  "$0" stop
  "$0" start
  ;;
*)
  echo "Usage: $0 {start|stop|restart}"
  exit 1
esac
