]>
Commit | Line | Data |
---|---|---|
c874b005 AM |
1 | #!/bin/sh |
2 | # | |
e0f55333 | 3 | # bluetooth Bluetooth subsystem starting and stopping. Turn HID adapters into Bluetooth ones. |
c874b005 | 4 | # |
829382b7 | 5 | # chkconfig: 345 50 83 |
c874b005 AM |
6 | # |
7 | # description: Bluetooth subsystem | |
8 | # | |
9 | # $Id$ | |
10 | ||
11 | ||
12 | # Source function library | |
13 | . /etc/rc.d/init.d/functions | |
14 | ||
c874b005 AM |
15 | [ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth |
16 | ||
c874b005 AM |
17 | start() { |
18 | # Check if the service is already running? | |
19 | if [ ! -f /var/lock/subsys/bluetooth ]; then | |
e0f55333 AM |
20 | if [ -x /sbin/udevadm ]; then |
21 | msg_starting "Bluetooth devices" | |
c2b3f5cc | 22 | daemon /sbin/udevadm trigger --subsystem-match=bluetooth --action=add |
e0f55333 AM |
23 | RETVAL=$? |
24 | touch /var/lock/subsys/bluetooth | |
25 | fi | |
c874b005 AM |
26 | else |
27 | msg_already_running bluetooth | |
28 | fi | |
29 | } | |
30 | ||
31 | stop() { | |
32 | if [ -f /var/lock/subsys/bluetooth ]; then | |
e0f55333 | 33 | # nothing needed to stop it |
c874b005 AM |
34 | rm -f /var/lock/subsys/bluetooth |
35 | else | |
36 | msg_not_running bluetooth | |
37 | fi | |
38 | } | |
39 | ||
c762e736 JB |
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 | ||
c874b005 AM |
50 | RETVAL=0 |
51 | # See how we were called. | |
52 | case "$1" in | |
53 | start) | |
a18a42aa | 54 | start |
c874b005 AM |
55 | ;; |
56 | stop) | |
a18a42aa | 57 | stop |
c874b005 | 58 | ;; |
829382b7 | 59 | restart|reload|force-reload) |
c874b005 AM |
60 | stop |
61 | start | |
62 | ;; | |
c762e736 JB |
63 | try-restart) |
64 | condrestart 0 | |
65 | ;; | |
c874b005 | 66 | status) |
c874b005 | 67 | if [ -f /var/lock/subsys/bluetooth ]; then |
b5a4e9a8 | 68 | nls "bluetooth is running" |
c874b005 AM |
69 | exit 0 |
70 | else | |
b5a4e9a8 TP |
71 | msg_not_running bluetooth |
72 | exit 3 | |
a18a42aa | 73 | fi |
c874b005 AM |
74 | ;; |
75 | *) | |
c762e736 | 76 | msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" |
c874b005 AM |
77 | exit 3 |
78 | esac | |
79 | ||
80 | exit $RETVAL |