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