]>
Commit | Line | Data |
---|---|---|
829382b7 AM |
1 | #!/bin/sh |
2 | # | |
3 | # rfcomm Bluetooth RFCOMM setup. Sets up serial devices over Bluetooth. | |
4 | # | |
5 | # chkconfig: 345 27 88 | |
6 | # | |
7 | # description: Bluetooth RFCOMM setup | |
8 | # | |
9 | # $Id$ | |
10 | ||
11 | ||
12 | # Source function library | |
13 | . /etc/rc.d/init.d/functions | |
14 | ||
15 | UART_CONF="/etc/bluetooth/uart" | |
16 | [ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth | |
17 | ||
18 | if [ "$UART_CONF" != "no" -a ! -f "$UART_CONF" ]; then | |
19 | UART_CONF="no" | |
20 | fi | |
21 | ||
22 | start() { | |
23 | # Check if the service is already running? | |
24 | if [ ! -f /var/lock/subsys/rfcomm ]; then | |
25 | msg_starting rfcomm | |
26 | daemon /usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all | |
27 | RETVAL=$? | |
28 | touch /var/lock/subsys/rfcomm | |
29 | else | |
30 | msg_already_running rfcomm | |
31 | fi | |
32 | } | |
33 | ||
34 | stop() { | |
35 | if [ -f /var/lock/subsys/rfcomm ]; then | |
36 | msg_stopping rfcomm | |
37 | daemon /usr/bin/rfcomm release all | |
38 | rm -f /var/lock/subsys/rfcomm | |
39 | else | |
b5a4e9a8 | 40 | msg_not_running rfcomm |
829382b7 AM |
41 | fi |
42 | } | |
43 | ||
44 | condrestart() { | |
45 | if [ -f /var/lock/subsys/rfcomm ]; then | |
46 | stop | |
47 | start | |
48 | else | |
49 | msg_not_running rfcomm | |
50 | RETVAL=$1 | |
51 | fi | |
52 | } | |
53 | ||
54 | RETVAL=0 | |
55 | # See how we were called. | |
56 | case "$1" in | |
57 | start) | |
58 | start | |
59 | ;; | |
60 | stop) | |
61 | stop | |
62 | ;; | |
63 | restart|reload|force-reload) | |
64 | stop | |
65 | start | |
66 | ;; | |
67 | try-restart) | |
68 | condrestart 0 | |
69 | ;; | |
70 | status) | |
71 | if [ -f /var/lock/subsys/rfcomm ]; then | |
b5a4e9a8 | 72 | nls "rfcomm is running" |
829382b7 AM |
73 | exit 0 |
74 | else | |
b5a4e9a8 TP |
75 | msg_not_running rfcomm |
76 | exit 3 | |
829382b7 AM |
77 | fi |
78 | ;; | |
79 | *) | |
80 | msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" | |
81 | exit 3 | |
82 | esac | |
83 | ||
84 | exit $RETVAL |