#!/bin/bash
#
#	/etc/rc.d/init.d/rarpd
#
# Starts the rarpd daemon
#
# chkconfig: - 82 16
# description: Server Reverse Address Resolution Protocol requests.
# processname: rarpd

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

test -x /usr/sbin/rarpd -a -f /etc/ethers || exit 0

RETVAL=0
prog="rarpd"

start() {
	# Check if rarpd is already running
	if [ ! -f /var/lock/subsys/rarpd ]; then
	    echo -n $"Starting $prog: "
	    daemon /usr/sbin/rarpd
	    RETVAL=$?
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rarpd
	    echo
	fi
	return $RETVAL
}

stop() {
	echo -n $"Stopping $prog: "
	killproc /usr/sbin/rarpd
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rarpd
	echo
	return $RETVAL
}

#
#	See how we were called.
#
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  reload|restart)
        stop
	start
	;;
  condrestart)
	if [ -f /var/lock/subsys/rarpd ]; then
	    stop
	    start
	fi
	;;
  status)
	status /usr/sbin/rarpd
	RETVAL=$?
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
	exit 1
esac

exit $RETVAL
