#!/bin/sh # # dhcrelay This shell script takes care of starting and stopping # dhcrelay. # # chkconfig: - 65 35 # description: \ # The Internet Software Consortium DHCP Relay Agent, dhcrelay, provides a \ # means for relaying DHCP and BOOTP requests from a subnet to which no \ # DHCP server is directly connected to one or more DHCP servers on other \ # subnets. # # processname: dhcrelay # pidfile: /var/run/dhcrelay.pid WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions # Source networking configuration. SourceIfNotEmpty /etc/sysconfig/network PIDFILE=/var/run/dhcrelay.pid LOCKFILE=/var/lock/subsys/dhcrelay # Source config. SourceIfNotEmpty /etc/sysconfig/dhcrelay RETVAL=0 start() { # Check that networking is on and at least one DHCP server to relay to was specified. is_yes "$NETWORKING" && [ -n "$SERVERS" ] || return 0 start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user dhcrelay -- dhcrelay $OPTIONS $SERVERS RETVAL=$? return $RETVAL } stop() { stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user dhcrelay -- dhcrelay RETVAL=$? return $RETVAL } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload|restart) restart ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condreload|condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; status) status --pidfile "$PIDFILE" --expect-user dhcrelay -- dhcrelay RETVAL=$? ;; *) msg_usage "${0##*/} {start|stop|restart|condstop|condrestart|status}" RETVAL=1 esac exit $RETVAL