]> git.pld-linux.org Git - packages/bluez.git/blame_incremental - bluez.init
- up to 5.47
[packages/bluez.git] / bluez.init
... / ...
CommitLineData
1#!/bin/sh
2#
3# bluetooth Bluetooth subsystem starting and stopping. Turn HID adapters into Bluetooth ones.
4#
5# chkconfig: 345 50 83
6#
7# description: Bluetooth subsystem
8#
9# $Id$
10
11
12# Source function library
13. /etc/rc.d/init.d/functions
14
15[ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth
16
17start() {
18 # Check if the service is already running?
19 if [ -f /var/lock/subsys/bluetooth ]; then
20 msg_already_running bluetooth
21 return
22 fi
23
24 if [ ! -x /sbin/udevadm ]; then
25 return
26 fi
27
28 msg_starting "Bluetooth devices"
29 daemon /sbin/udevadm trigger --subsystem-match=bluetooth --action=add
30 RETVAL=$?
31 touch /var/lock/subsys/bluetooth
32}
33
34stop() {
35 if [ ! -f /var/lock/subsys/bluetooth ]; then
36 msg_not_running bluetooth
37 return
38 fi
39
40 # nothing needed to stop it
41 rm -f /var/lock/subsys/bluetooth
42}
43
44condrestart() {
45 if [ ! -f /var/lock/subsys/bluetooth ]; then
46 msg_not_running bluetooth
47 RETVAL=$1
48 return
49 fi
50
51 stop
52 start
53}
54
55status() {
56 if [ ! -f /var/lock/subsys/bluetooth ]; then
57 msg_not_running bluetooth
58 RETVAL=3
59 return $RETVAL
60 fi
61
62 nls "bluetooth is running"
63}
64
65RETVAL=0
66# See how we were called.
67case "$1" in
68 start)
69 start
70 ;;
71 stop)
72 stop
73 ;;
74 restart|reload|force-reload)
75 stop
76 start
77 ;;
78 try-restart)
79 condrestart 0
80 ;;
81 status)
82 status
83 RETVAL=$?
84 ;;
85 *)
86 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
87 exit 3
88esac
89
90exit $RETVAL
This page took 0.191829 seconds and 4 git commands to generate.