#!/bin/sh
#
# mdnsd     Start/Stop Multicast DNS Daemon
#
# chkconfig: 2345 90 10
# description: Startup/shutdown script for the Multicast DNS \
#              Daemon (providing support for ZeroConf)
# processname: mdnsd
#
# Copyright 2005 Ark Linux

# Source function library.
if [ -f /etc/init.d/functions ] ; then
	. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
	. /etc/rc.d/init.d/functions
else
	exit 0
fi

DAEMON=mdnsd

start () {
	# start daemon
	echo -n "Starting $DAEMON: "
	daemon $DAEMON
        RETVAL=$?
	echo
	[ $RETVAL = 0 ] && touch /var/lock/subsys/mdnsd
	return $RETVAL
}

stop () {
	# stop daemon
	echo -n "Stopping $DAEMON: "
	killproc $DAEMON
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/mdnsd
}

restart() {
	stop
	start
}

case $1 in
	start)
		start
	;;
	stop)
		stop
	;;
	restart)
		restart
	;;
	condrestart)
		[ -f /var/lock/subsys/cups ] && restart
	;;	
	status)
		status $DAEMON
	;;
	*)

	echo "Usage: $DAEMON {start|stop|restart|status|condrestart}"
	exit 1
esac

exit $RETVAL
