dhcp/dhcpd.init
cvsdist 37d2807ff3 auto-import changelog data from dhcp-3.0.1rc12-4.src.rpm
3.0.1rc12-4
- Fix init to check config during restart
3.0.1rc12-3
- Fix init script to create leases file if missing
2004-09-09 04:15:43 +00:00

97 lines
1.5 KiB
Bash

#!/bin/sh
#
# dhcpd This shell script takes care of starting and stopping
# dhcpd.
#
# chkconfig: - 65 35
# description: dhcpd provide access to Dynamic Host Control Protocol.
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
. /etc/sysconfig/dhcpd
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/sbin/dhcpd ] || exit 0
[ -f /etc/dhcpd.conf ] || exit 0
[ -f /var/lib/dhcp/dhcpd.leases ] || touch /var/lib/dhcp/dhcpd.leases
RETVAL=0
prog="dhcpd"
configtest()
{
local retval TEMP=/tmp/dhcpd$$.err
/usr/sbin/dhcpd -t 2>$TEMP
retval=$?
if [ $retval -ne 0 ]
then
cat $TEMP
rm -f $TEMP
fi
return $retval
}
start() {
# Start daemons.
echo -n $"Starting $prog: "
daemon /usr/sbin/dhcpd ${DHCPDARGS}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc dhcpd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcpd
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
configtest || exit $?
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/dhcpd ]; then
stop
start
RETVAL=$?
fi
;;
configtest)
configtest
RETVAL=$?
;;
status)
status dhcpd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
exit 1
esac
exit $RETVAL