#!/bin/sh
#
# nifd:       Starts the nifd Daemon
#
# chkconfig: 345 33 67
# description: This is a daemon which runs on Howl clients to monitor the \
#              state of a network interface.  nifd must be running on systems \
#              that use autoipd and mDNSResponder to automatically obtain a  \
#              Link-Local IPv4 address and do Zeroconf service discovery. \
#              nifd should not be running otherwise.
# processname: nifd
# pidfile /var/run/nifd.pid
# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

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

LOCKFILE=/var/lock/subsys/nifd
PIDFILE=/var/run/nifd.pid
RETVAL=0
NIFD_OPTS=""

# Check that networking is configured.
SourceIfNotEmpty /etc/sysconfig/network && [ "$NETWORKING" != no ] || exit

start() {
	start_daemon --pidfile $PIDFILE --lockfile "$LOCKFILE" --expect-user root -- nifd $NIFD_OPTS
	RETVAL=$?
	return $RETVAL
}

stop() {
	start_daemon --pidfile $PIDFILE --lockfile "$LOCKFILE" --expect-user root -- nifd
	RETVAL=$?
	return $RETVAL
}

restart() {
	stop
	start
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	status --pidfile $PIDFILE --expect-user root nifd
	;;
  restart|reload)
	restart
	;;
  condrestart)
	if [ -f "$LOCKFILE" ]; then
	    restart
	fi        
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|condrestart}"
	exit 1
esac

exit $?
