]> git.pld-linux.org Git - packages/bluez.git/blame - bluez.init
- rel 2; init scripts into separate files
[packages/bluez.git] / bluez.init
CommitLineData
c874b005
AM
1#!/bin/sh
2#
3# bluetooth Bluetooth subsystem starting and stopping
4#
829382b7 5# chkconfig: 345 50 83
c874b005
AM
6#
7# description: Bluetooth subsystem
8#
9# $Id$
10
11
12# Source function library
13. /etc/rc.d/init.d/functions
14
c874b005
AM
15[ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth
16
c874b005
AM
17start() {
18 # Check if the service is already running?
19 if [ ! -f /var/lock/subsys/bluetooth ]; then
829382b7
AM
20 msg_starting hid2hci
21 daemon /usr/sbin/hid2hci -q -r hci
22 RETVAL=$?
23 /bin/sleep 1 # delay for hid's to be detected by hotplug
c874b005
AM
24 touch /var/lock/subsys/bluetooth
25 else
26 msg_already_running bluetooth
27 fi
28}
29
30stop() {
31 if [ -f /var/lock/subsys/bluetooth ]; then
829382b7
AM
32 msg_stopping hid2hci
33 daemon /usr/sbin/hid2hci -q -r hid
c874b005
AM
34 rm -f /var/lock/subsys/bluetooth
35 else
36 msg_not_running bluetooth
37 fi
38}
39
c762e736
JB
40condrestart() {
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
c874b005
AM
50RETVAL=0
51# See how we were called.
52case "$1" in
53 start)
a18a42aa 54 start
c874b005
AM
55 ;;
56 stop)
a18a42aa 57 stop
c874b005 58 ;;
829382b7 59 restart|reload|force-reload)
c874b005
AM
60 stop
61 start
62 ;;
c762e736
JB
63 try-restart)
64 condrestart 0
65 ;;
c874b005 66 status)
c874b005
AM
67 if [ -f /var/lock/subsys/bluetooth ]; then
68 exit 0
69 else
70 exit 1
a18a42aa 71 fi
c874b005
AM
72 ;;
73 *)
c762e736 74 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
c874b005
AM
75 exit 3
76esac
77
78exit $RETVAL
This page took 0.041162 seconds and 4 git commands to generate.