Blame | Last modification | View Log | RSS feed
#!/bin/sh#### BEGIN INIT INFO# Provides: dhcpd# Default-Start:# Default-Stop:# Should-Start: portreserve# Required-Start: $network# Required-Stop:# Short-Description: Start and stop the DHCP server# Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP)# server.### END INIT INFO## The fields below are left around for legacy tools (will remove later).## chkconfig: - 65 35# description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP) \# server# processname: dhcpd# config: /etc/dhcp/dhcpd.conf# config: /var/lib/dhcpd/dhcpd.leases# pidfile: /var/run/dhcpd.pid. /etc/rc.d/init.d/functionsRETVAL=0prog=dhcpduser=dhcpdgroup=dhcpdexec=/usr/sbin/dhcpdlockfile=/var/lock/subsys/dhcpdpidfile=/var/run/dhcpd.pidstatedir=/var/lib/dhcpd[ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd# if the user specified a different config file, make sure we reference itfindConfig() {for arg in $DHCPDARGS ; doif [ "$found" = 1 ]; then[ -f "$arg" ] && echo "$arg"returnfiif [ "$arg" = "-cf" ]; thenfound=1continuefidoneecho "/etc/dhcp/dhcpd.conf"}config="$(findConfig "$DHCPDARGS")"if [ ! -f $statedir/dhcpd.leases ] ; thenmkdir -p $statedirtouch $statedir/dhcpd.leases[ -x /sbin/restorecon ] && [ -d /selinux ] && /sbin/restorecon $statedir/dhcpd.leases >/dev/null 2>&1ficonfigtest() {[ -x $exec ] || return 5[ -f $config ] || return 6$exec -q -t -cf $configRETVAL=$?if [ $RETVAL -eq 1 ]; then$exec -t -cf $configelseecho "Syntax: OK" >&2fireturn $RETVAL}rh_status() {status -p $pidfile $exec}rh_status_q() {rh_status >/dev/null 2>&1}start() {[ `id -u` -eq 0 ] || return 4[ -x $exec ] || return 5[ -f $config ] || return 6rh_status_q && return 0echo -n $"Starting $prog: "# tell portreserve to release the port[ -x /sbin/portrelease ] && /sbin/portrelease dhcpd &>/dev/null || :daemon --pidfile=$pidfile $exec -user $user -group $group $DHCPDARGS 2>/dev/nullRETVAL=$?echo[ $RETVAL -eq 0 ] && touch $lockfilereturn $RETVAL}stop() {[ `id -u` -eq 0 ] || return 4rh_status_q || return 0echo -n $"Shutting down $prog: "killproc -p $pidfile $progRETVAL=$?echo[ $RETVAL -eq 0 ] && rm -f $lockfilereturn $RETVAL}usage() {echo $"Usage: $0 {start|stop|restart|force-reload|condrestart|try-restart|configtest|status}"}if [ $# -gt 1 ]; thenexit 2ficase "$1" instart)start;;stop)stop;;restart|force-reload)stop ; start;;condrestart|try-restart)rh_status_q || exit 0stop ; start;;reload)usage# unimplemented featureexit 3;;configtest)configtest;;status)rh_status;;*)usageexit 2;;esacexit $?