#!/bin/sh
#
# kudzu	The Red Hat Linux hardware probing tool.
#
# chkconfig:	345 05 95
#
# description:	Kudzu is a hardware probing tool run at system boot time to determine \
#		what hardware has been added or removed from the system.
#
# $Id: kudzu.init,v 1.8 2005/12/08 00:41:26 glen Exp $


# Source function library
. /etc/rc.d/init.d/functions

# Set defaults
OPTION1=""	# Strings
OPTION2="-q"	#
OPTION3=	# Values
OPTION4=5	#

# Get service config - may override defaults
[ -f /etc/sysconfig/kudzu ] && . /etc/sysconfig/kudzu

RETVAL=0
# See how we were called.
case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/kudzu ]; then
		# check whether another kudzu process is not started manually
		if pidof kudzu >/dev/null; then
			sleep 30
			killall kudzu
			killall -9 kudzu
		fi
		msg_starting kudzu
		touch /var/lock/subsys/kudzu
		daemon kudzu --quiet
		RETVAL=$?
		rm -f /var/lock/subsys/kudzu >/dev/null 2>&1
	else
		msg_already_running kudzu
	fi
	;;
  stop)
	killall kudzu
	killall -9 kudzu
	rm -f /var/lock/subsys/kudzu >/dev/null 2>&1
	;;
  restart|force-reload)
	$0 stop
	$0 start
	exit $?
	;;
  status)
	status kudzu
	exit $?
	;;
  *)
	msg_usage "$0 {start|stop|restart|force-reload|status}"
	exit 3
esac

exit $RETVAL

# This must be last line !
# vi:syntax=sh:tw=78:ts=8:sw=4
