X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=dhcp-relay.init;h=a76b49d53b97a90fe6d6cf965e77a52eb526ef16;hb=8cf9160b665eb720b0d6d151440a187a35eb6d11;hp=62c327c63f520545399e2b5999381708815e1ed7;hpb=3b314dfacc4f669b0cc5324d78936bf2af514ca6;p=packages%2Fdhcp.git diff --git a/dhcp-relay.init b/dhcp-relay.init index 62c327c..a76b49d 100644 --- a/dhcp-relay.init +++ b/dhcp-relay.init @@ -1,8 +1,8 @@ #!/bin/sh -# DHCP Server +# DHCP relay agent # # chkconfig: 345 80 20 -# description: DHCP Relay +# description: DHCP relay agent # Source function library. . /etc/rc.d/init.d/functions @@ -11,37 +11,60 @@ . /etc/sysconfig/network # Demon specified configuration. +OPTIONS="" . /etc/sysconfig/dhcp-relay # Check that networking is up. -if is_no "${NETWORKING}"; then - msg_Network_Down "DHCP Realay" - exit 1 +if is_yes "${NETWORKING}"; then + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then + msg_network_down "DHCP realay" + exit 1 + fi +else + exit 0 fi +if [ -n "DHCP_RELAY_INTERFACES" ]; then + for iface in $DHCP_RELAY_INTERFACES ; do + OPTIONS="$OPTIONS -i $iface" + done +fi + +RETVAL=0 # See how we were called. case "$1" in start) - msg_starting "DHCP Relay" - daemon dhcrelay $DHCP_SERVERS - touch /var/lock/subsys/dhcrelay + # Check if the service is already running? + if [ ! -f /var/lock/subsys/dhcp-relay ]; then + msg_starting "DHCP relay" + daemon dhcrelay $OPTIONS $DHCP_SERVERS_IP + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcp-relay + else + msg_already_running "DHCP relay" + fi ;; stop) - msg_stopping "DHCP Relay" - killproc dhcrelay - rm -f /var/lock/subsys/dhcrelay + if [ -f /var/lock/subsys/dhcp-relay ]; then + msg_stopping "DHCP relay" + killproc dhcrelay + rm -f /var/lock/subsys/dhcp-relay + else + msg_not_running "DHCP relay" + fi ;; - restart) + restart|force-reload) $0 stop $0 start + exit $? ;; status) status dhcrelay + exit $? ;; *) - msg_Usage "$0 {start|stop|restart|status}" - exit 1 + msg_usage "$0 {start|stop|restart|force-reload|status}" + exit 3 esac -exit 0 - +exit $RETVAL