#!/bin/sh
# $Owl: Owl/packages/dhcp/dhcpd.init,v 1.11 2006/09/18 23:36:27 ldv Exp $
#
# chkconfig: - 60 40
# description: \
# 	The Internet Software Consortium DHCP Server, dhcpd, implements \
# 	the Dynamic Host Configuration Protocol (DHCP) and the Internet \
# 	Bootstrap Protocol (BOOTP).  DHCP allows hosts on a TCP/IP network \
# 	to request and be assigned IP addresses, and also to discover \
# 	information about the network to which they are attached.  BOOTP \
# 	provides similar functionality, with certain restrictions.
# processname: dhcpd
# config: /etc/dhcpd.conf
# pidfile: /var/run/dhcpd.pid

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

DHCPDARGS=
# Source local dhcpd configuration.
. /etc/sysconfig/dhcpd

OWL_STARTUP_ENABLE=1

PIDFILE=/var/run/dhcpd.pid
DHCPD_CONF=/etc/dhcpd.conf
DHCPD_CONF_SAMPLE=/etc/dhcpd.conf.sample

case "$1" in
start)
	daemon --pidfile "$PIDFILE" --expect-user dhcp -- \
		dhcpd -u dhcp -j /var/lib/dhcp/dhcpd $DHCPDARGS
	STATUS=$?
	if [ $STATUS -ne 0 -a ! -e "$DHCPD_CONF" -a -e "$DHCPD_CONF_SAMPLE" ]; then
		echo
		echo -n "There is a sample configuration file under "
		echo "$DHCPD_CONF_SAMPLE"
	fi
	exit $STATUS
	;;
stop)
	killproc --pidfile "$PIDFILE" --expect-user dhcp dhcpd
	;;
status)
	status --pidfile "$PIDFILE" --expect-user dhcp dhcpd
	;;
reload|restart)
	$0 stop
	$0 start
	;;
*)
	echo "Usage: ${0##*/} {start|stop|status|restart}"
	exit 1
esac

exit $?
