]> git.pld-linux.org Git - packages/bluez.git/blame - bluez.init
- explicit add udev action
[packages/bluez.git] / bluez.init
CommitLineData
c874b005
AM
1#!/bin/sh
2#
e0f55333 3# bluetooth Bluetooth subsystem starting and stopping. Turn HID adapters into Bluetooth ones.
c874b005 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
e0f55333
AM
20 if [ -x /sbin/udevadm ]; then
21 msg_starting "Bluetooth devices"
c2b3f5cc 22 daemon /sbin/udevadm trigger --subsystem-match=bluetooth --action=add
e0f55333
AM
23 RETVAL=$?
24 touch /var/lock/subsys/bluetooth
25 fi
c874b005
AM
26 else
27 msg_already_running bluetooth
28 fi
29}
30
31stop() {
32 if [ -f /var/lock/subsys/bluetooth ]; then
e0f55333 33 # nothing needed to stop it
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.106559 seconds and 4 git commands to generate.