]> git.pld-linux.org Git - packages/bluez.git/blob - rfcomm.init
- rel 4
[packages/bluez.git] / rfcomm.init
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_already_running rfcomm
26                 return
27         fi
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
33 }
34
35 stop() {
36         if [ ! -f /var/lock/subsys/rfcomm ]; then
37                 msg_not_running rfcomm
38                 return
39         fi
40
41         msg_stopping rfcomm
42         daemon /usr/bin/rfcomm release all
43         rm -f /var/lock/subsys/rfcomm
44 }
45
46 condrestart() {
47         if [ ! -f /var/lock/subsys/rfcomm ]; then
48                 msg_not_running rfcomm
49                 RETVAL=$1
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
62         fi
63
64         nls "rfcomm is running"
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)
84         status
85         ;;
86   *)
87         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
88         exit 3
89 esac
90
91 exit $RETVAL
This page took 0.041013 seconds and 3 git commands to generate.