#!/bin/sh # # bluetooth Bluetooth subsystem starting and stopping. Turn HID adapters into Bluetooth ones. # # chkconfig: 345 50 83 # # description: Bluetooth subsystem # # $Id$ # Source function library . /etc/rc.d/init.d/functions [ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/bluetooth ]; then if [ -x /sbin/udevadm ]; then msg_starting "Bluetooth devices" daemon /sbin/udevadm trigger --subsystem-match=bluetooth --action=add RETVAL=$? touch /var/lock/subsys/bluetooth fi else msg_already_running bluetooth fi } stop() { if [ -f /var/lock/subsys/bluetooth ]; then # nothing needed to stop it rm -f /var/lock/subsys/bluetooth else msg_not_running bluetooth fi } condrestart() { if [ -f /var/lock/subsys/bluetooth ]; then stop start else msg_not_running bluetooth RETVAL=$1 fi } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload|force-reload) stop start ;; try-restart) condrestart 0 ;; status) if [ -f /var/lock/subsys/bluetooth ]; then nls "bluetooth is running" exit 0 else msg_not_running bluetooth exit 3 fi ;; *) msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" exit 3 esac exit $RETVAL