From 967b575d077ba15d634ed938c3ad74fc278adff0 Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Wed, 16 Apr 2003 15:02:14 +0000 Subject: [PATCH] - started init script, based on one for RH systems Changed files: bluez-utils.init -> 1.1 bluez-utils.sysconfig -> 1.1 --- bluez-utils.init | 109 ++++++++++++++++++++++++++++++++++++++++++ bluez-utils.sysconfig | 8 ++++ 2 files changed, 117 insertions(+) create mode 100644 bluez-utils.init create mode 100644 bluez-utils.sysconfig diff --git a/bluez-utils.init b/bluez-utils.init new file mode 100644 index 0000000..a298224 --- /dev/null +++ b/bluez-utils.init @@ -0,0 +1,109 @@ +#!/bin/sh +# +# bluetooth Bluetooth subsystem starting and stopping +# +# chkconfig: 345 25 90 +# +# description: Bluetooth subsystem +# +# $Id$ + + +# Source function library +. /etc/rc.d/init.d/functions + +UART_CONF="/etc/bluetooth/uart" +[ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth + +if [ "$UART_CONF" != "no" -a ! -f "$UART_CONF" ]; then + UART_CONF="no" +fi + +# See how we were called. +case "$1" in + start) + # Check if the service is already running? + if [ ! -f /var/lock/subsys/bluetooth ]; then + # show "Starting %s service" Bluetooth + msg_starting Bluetooth + if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then + grep -v '^#' $UART_CONF | while read i; do + /usr/sbin/hciattach $i + done + fi + daemon /usr/sbin/hcid -f /etc/bluetooth/hcid.conf + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + killproc hciattach >/dev/null 2>&1 + elif [ -x /usr/sbin/sdpd ]; then + msg_starting "Bluetooth SDP" + daemon /usr/sbin/sdpd + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + killproc hcid >/dev/null 2>&1 + if [ "$UART_CONF" != "no" ]; then + killproc hciattach >/dev/null 2>&1 + fi + fi + fi + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bluetooth + else + # show "%s service is already running." Bluetooth + msg_already_running Bluetooth + exit 1 + fi + ;; + stop) + if [ -f /var/lock/subsys/bluetooth ]; then + if [ -x /usr/sbin/sdpd ]; then + msg_stopping "Bluetooth SDP" + killproc sdpd + fi + # show "Stopping %s service" Bluetooth + msg_stopping Bluetooth + killproc hcid + RETVAL=$? + if [ "$UART_CONF" != "no" ]; then + killproc hciattach >/dev/null 2>&1 + fi + rm -f /var/lock/subsys/bluetooth + else + # show "%s service is not running." Bluetooth + msg_not_running Bluetooth + exit 1 + fi + ;; + restart) + $0 stop + $0 start + ;; + reload) + if [ -f /var/lock/subsys/bluetooth ]; then + # show "Reload %s service" Bluetooth + msg_reloading Bluetooth + killproc hcid -HUP + RETVAL=$? + else + # show "%s service is not running." Bluetooth + msg_not_running Bluetooth + RETVAL=1 + fi + ;; + force-reload) + # if program allows reloading without stopping + $0 reload + ;; + status) + status hcid + RETVAL=$? + ;; + *) + # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0 + msg_usage "$0 {start|stop|status|restart|reload|force-reload}" + exit 1 +esac + +exit $RETVAL + +# This must be last line ! +# vi:syntax=sh:tw=78:ts=8:sw=4 diff --git a/bluez-utils.sysconfig b/bluez-utils.sysconfig new file mode 100644 index 0000000..7a8c423 --- /dev/null +++ b/bluez-utils.sysconfig @@ -0,0 +1,8 @@ +# Customized settings for Bluetooth + +# Define nice level for Bluetooth services +SERVICE_RUN_NICE_LEVEL="+0" + +# remove if you have serial Bluetooth dongles configured in /etc/bluetooth/uart +# (alternatively you can pass uart configuration file path here) +UART_CONF="no" -- 2.44.0