]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # | |
3 | # bluetooth Bluetooth subsystem starting and stopping. Turn HID adapters into Bluetooth ones. | |
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 | if [ -x /sbin/udevadm ]; then | |
21 | msg_starting "Bluetooth devices" | |
22 | daemon /sbin/udevadm trigger --subsystem-match=bluetooth | |
23 | RETVAL=$? | |
24 | touch /var/lock/subsys/bluetooth | |
25 | fi | |
26 | else | |
27 | msg_already_running bluetooth | |
28 | fi | |
29 | } | |
30 | ||
31 | stop() { | |
32 | if [ -f /var/lock/subsys/bluetooth ]; then | |
33 | # nothing needed to stop it | |
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 |