#!/bin/bash
#
#	/etc/rc.d/init.d/rarpd
#
# Starts the rarpd daemon
#
# chkconfig: - 82 16
# description: Server Reverse Address Resolution Protocol requests.
# processname: rarpd
#
### BEGIN INIT INFO
# Provides: rarpd
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Short-Description: The RARP daemon
# Description: RARP (Reverse Address Resolution Protocol) is a protocol which allows
#              individual devices on an IP network to get their own IP addresses from the
#              RARP server.The Network Time Protocol (NTP) is used to synchronize a
#              computer's time with another reference time source.
### END INIT INFO

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

RETVAL=0
SERVICE=rarpd

[ -x /usr/sbin/$SERVICE -a -f /etc/ethers ] || exit 0

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

stop() {
	gprintf "Stopping %s: " "$SERVICE"
	killproc $SERVICE
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE
	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/$SERVICE ]; then
	    stop
	    start
	fi
	;;
  status)
	status $SERVICE
	RETVAL=$?
	;;
  *)
	gprintf "Usage: %s {start|stop|restart|condrestart|reload|status}\n" "$SERVICE"
	exit 1
esac

exit $RETVAL
