#!/bin/sh # ### BEGIN INIT INFO # Provides: dhcrelay # Default-Start: 2 3 4 5 # Default-Stop: # Should-Start: # Required-Start: $network # Required-Stop: $network # Short-Description: Start and stop the DHCP relay server # Description: dhcrelay provides the Dynamic Host Configuration Protocol (DHCP) # relay server. This is required when your DHCP server is on # another network segment from the clients. ### END INIT INFO # # The fields below are left around for legacy tools (will remove later). # # chkconfig: - 65 35 # description: dhcrelay provides a relay for Dynamic Host Control Protocol. # processname: dhcrelay # # pidfile: /var/run/dhcrelay.pid . /etc/rc.d/init.d/functions [ -x /usr/sbin/dhcrelay ] || exit 0 # Define SERVERS with a list of one or more DHCP servers where # DHCP packets are to be relayed to and from. This is mandatory. SERVERS="" # Define OPTIONS with any other options to pass to the dhcrelay server. OPTIONS="-q" # Values specified in this file override the defaults above. [ -f /etc/sysconfig/dhcrelay ] && . /etc/sysconfig/dhcrelay # Check that at least one DHCP server to relay to was specified. [ "${SERVERS}" = "" ] && exit 0 RETVAL=0 start() { # Start daemons. echo -n "Starting dhcrelay: " daemon /usr/sbin/dhcrelay $OPTIONS $SERVERS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcrelay return $RETVAL } stop() { # Stop daemons. echo -n "Shutting down dhcrelay: " killproc dhcrelay RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcrelay return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/dhcrelay ]; then stop start RETVAL=$? fi ;; status) status dhcrelay RETVAL=$? ;; *) echo "Usage: dhcrelay {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL