]>
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? | |
270dad27 | 19 | if [ -f /var/lock/subsys/bluetooth ]; then |
c874b005 | 20 | msg_already_running bluetooth |
270dad27 ER |
21 | return |
22 | fi | |
23 | ||
24 | if [ ! -x /sbin/udevadm ]; then | |
25 | return | |
c874b005 | 26 | fi |
270dad27 ER |
27 | |
28 | msg_starting "Bluetooth devices" | |
29 | daemon /sbin/udevadm trigger --subsystem-match=bluetooth --action=add | |
30 | RETVAL=$? | |
31 | touch /var/lock/subsys/bluetooth | |
c874b005 AM |
32 | } |
33 | ||
34 | stop() { | |
270dad27 | 35 | if [ ! -f /var/lock/subsys/bluetooth ]; then |
c874b005 | 36 | msg_not_running bluetooth |
270dad27 | 37 | return |
c874b005 | 38 | fi |
270dad27 ER |
39 | |
40 | # nothing needed to stop it | |
41 | rm -f /var/lock/subsys/bluetooth | |
c874b005 AM |
42 | } |
43 | ||
c762e736 | 44 | condrestart() { |
270dad27 | 45 | if [ ! -f /var/lock/subsys/bluetooth ]; then |
c762e736 JB |
46 | msg_not_running bluetooth |
47 | RETVAL=$1 | |
270dad27 ER |
48 | return |
49 | fi | |
50 | ||
51 | stop | |
52 | start | |
53 | } | |
54 | ||
55 | status() { | |
56 | if [ ! -f /var/lock/subsys/bluetooth ]; then | |
57 | msg_not_running bluetooth | |
58 | RETVAL=3 | |
59 | return $RETVAL | |
c762e736 | 60 | fi |
270dad27 ER |
61 | |
62 | nls "bluetooth is running" | |
c762e736 JB |
63 | } |
64 | ||
c874b005 AM |
65 | RETVAL=0 |
66 | # See how we were called. | |
67 | case "$1" in | |
68 | start) | |
a18a42aa | 69 | start |
c874b005 AM |
70 | ;; |
71 | stop) | |
a18a42aa | 72 | stop |
c874b005 | 73 | ;; |
829382b7 | 74 | restart|reload|force-reload) |
c874b005 AM |
75 | stop |
76 | start | |
77 | ;; | |
c762e736 JB |
78 | try-restart) |
79 | condrestart 0 | |
80 | ;; | |
c874b005 | 81 | status) |
270dad27 ER |
82 | status |
83 | RETVAL=$? | |
c874b005 AM |
84 | ;; |
85 | *) | |
c762e736 | 86 | msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" |
c874b005 AM |
87 | exit 3 |
88 | esac | |
89 | ||
90 | exit $RETVAL |