bluetooth 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/sh
  2. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  3. DESC=bluetooth
  4. DAEMON=/usr/libexec/bluetooth/bluetoothd
  5. # If you want to be ignore error of "org.freedesktop.hostname1",
  6. # please enable NOPLUGIN_OPTION.
  7. # NOPLUGIN_OPTION="--noplugin=hostname"
  8. NOPLUGIN_OPTION=""
  9. SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- $NOPLUGIN_OPTION"
  10. test -f $DAEMON || exit 0
  11. # FIXME: any of the sourced files may fail if/with syntax errors
  12. test -f /etc/default/bluetooth && . /etc/default/bluetooth
  13. test -f /etc/default/rcS && . /etc/default/rcS
  14. set -e
  15. case $1 in
  16. start)
  17. echo "Starting $DESC"
  18. if test "$BLUETOOTH_ENABLED" = 0; then
  19. echo "disabled. see /etc/default/bluetooth"
  20. exit 0
  21. fi
  22. start-stop-daemon --start --background $SSD_OPTIONS
  23. echo "${DAEMON##*/}"
  24. ;;
  25. stop)
  26. echo "Stopping $DESC"
  27. if test "$BLUETOOTH_ENABLED" = 0; then
  28. echo "disabled."
  29. exit 0
  30. fi
  31. start-stop-daemon --stop $SSD_OPTIONS
  32. echo "${DAEMON}"
  33. ;;
  34. restart|force-reload)
  35. $0 stop
  36. sleep 1
  37. $0 start
  38. ;;
  39. status)
  40. pidof ${DAEMON} >/dev/null
  41. status=$?
  42. if [ $status -eq 0 ]; then
  43. echo "bluetooth is running."
  44. else
  45. echo "bluetooth is not running"
  46. fi
  47. exit $status
  48. ;;
  49. *)
  50. N=/etc/init.d/bluetooth
  51. echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
  52. exit 1
  53. ;;
  54. esac
  55. exit 0
  56. # vim:noet