]> git.pld-linux.org Git - packages/bluez.git/blob - bluez.init
- rel 2; init scripts into separate files
[packages/bluez.git] / bluez.init
1 #!/bin/sh
2 #
3 # bluetooth     Bluetooth subsystem starting and stopping
4 #
5 # chkconfig:    345 50 83
6 #
7 # description:  Bluetooth subsystem
8 #
9 # $Id$
10
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 [ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth
16
17 start() {
18         # Check if the service is already running?
19         if [ ! -f /var/lock/subsys/bluetooth ]; then
20                 msg_starting hid2hci
21                 daemon /usr/sbin/hid2hci -q -r hci
22                 RETVAL=$?
23                 /bin/sleep 1 # delay for hid's to be detected by hotplug
24                 touch /var/lock/subsys/bluetooth
25         else
26                 msg_already_running bluetooth
27         fi
28 }
29
30 stop() {
31         if [ -f /var/lock/subsys/bluetooth ]; then
32                 msg_stopping hid2hci
33                 daemon /usr/sbin/hid2hci -q -r hid
34                 rm -f /var/lock/subsys/bluetooth
35         else
36                 msg_not_running bluetooth
37         fi
38 }
39
40 condrestart() {
41         if [ -f /var/lock/subsys/bluetooth ]; then
42                 stop
43                 start
44         else
45                 msg_not_running bluetooth
46                 RETVAL=$1
47         fi
48 }
49
50 RETVAL=0
51 # See how we were called.
52 case "$1" in
53   start)
54         start
55         ;;
56   stop)
57         stop
58         ;;
59   restart|reload|force-reload)
60         stop
61         start
62         ;;
63   try-restart)
64         condrestart 0
65         ;;
66   status)
67         if [ -f /var/lock/subsys/bluetooth ]; then
68                 exit 0
69         else
70                 exit 1
71         fi
72         ;;
73   *)
74         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
75         exit 3
76 esac
77
78 exit $RETVAL
This page took 0.051954 seconds and 3 git commands to generate.