]> git.pld-linux.org Git - packages/bluez.git/blame - rfcomm.init
- rel 2; init scripts into separate files
[packages/bluez.git] / rfcomm.init
CommitLineData
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
15UART_CONF="/etc/bluetooth/uart"
16[ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth
17
18if [ "$UART_CONF" != "no" -a ! -f "$UART_CONF" ]; then
19 UART_CONF="no"
20fi
21
22start() {
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
34stop() {
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
40 msg_not_running bluetooth
41 fi
42}
43
44condrestart() {
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
54RETVAL=0
55# See how we were called.
56case "$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
72 exit 0
73 else
74 exit 1
75 fi
76 ;;
77 *)
78 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
79 exit 3
80esac
81
82exit $RETVAL
This page took 0.041187 seconds and 4 git commands to generate.