X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=dhcp-relay.init;h=121b5ea9ff3525204da010be193ee657558b51b1;hb=63525c7f5a0edf0f605ce3ff05005059eb1a6f83;hp=c67138a8ba19ed8d435de5b9083e38ee207ae28e;hpb=6dfd82edcf14beb5e2b816e3010aa9fe0480449b;p=packages%2Fdhcp.git diff --git a/dhcp-relay.init b/dhcp-relay.init index c67138a..121b5ea 100644 --- a/dhcp-relay.init +++ b/dhcp-relay.init @@ -11,48 +11,82 @@ . /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_REALY_INTERFACES" ]; then - OPTIONS="-i $DHCP_REALY_INTERFACES" +if [ -n "DHCP_RELAY_INTERFACES" ]; then + for iface in $DHCP_RELAY_INTERFACES ; do + OPTIONS="$OPTIONS -i $iface" + done fi - -# See how we were called. -case "$1" in - start) - # Check if the service is already running? +start() { if [ ! -f /var/lock/subsys/dhcp-relay ]; then msg_starting "DHCP relay" - daemon dhcrelay $OPTIONS $DHCP_SERVERS_IP + daemon /sbin/dhcrelay $OPTIONS $DHCP_SERVERS_IP RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcp-relay else - msg_Already_Running "DHCP relay" - exit 1 + msg_already_running "DHCP relay" + fi +} + +stop() { + 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 +} + +condrestart() { + if [ -f /var/lock/subsys/dhcp-relay ]; then + stop + start + else + msg_not_running "DHCP relay" + RETVAL=$1 + fi +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start ;; stop) - msg_stopping "DHCP relay" - killproc dhcrelay - rm -f /var/lock/subsys/dhcp-relay + stop + ;; + restart) + stop + start + ;; + try-restart) + condrestart 0 ;; - restart|reload) - $0 stop - $0 start + force-reload) + condrestart 7 ;; status) status dhcrelay + exit $? ;; *) - msg_Usage "$0 {start|stop|restart|reload|status}" - exit 1 + msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" + exit 3 esac exit $RETVAL