]> git.pld-linux.org Git - packages/dhcp.git/commitdiff
- silence default startup on errors
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 19 Nov 2009 13:20:25 +0000 (13:20 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- add configtest alias

Changed files:
    dhcp.init -> 1.23

dhcp.init

index fac0036386998bda7c99fd9c00747d7e079768a8..eeae182ed7efe32f236a07b3135bbab859f4ca35 100644 (file)
--- a/dhcp.init
+++ b/dhcp.init
@@ -35,11 +35,8 @@ check_device_up()
 
 # configtest itself
 configtest() {
-       local rc out
-       out=`/sbin/dhcpd -t 2>&1`; rc=$?
-       if [ $rc -gt 0 ]; then
-               echo >&2 "$out"
-       fi
+       local rc=0
+       /sbin/dhcpd -q -t -T || rc=$?
 
        # check if interfaces specified exist and have addresses
        for i in $DHCPD_INTERFACES; do
@@ -52,15 +49,22 @@ configtest() {
        return $rc
 }
 
-# wrapper for configtest:
+# wrapper for configtest
 checkconfig() {
        local details=${1:-0}
 
        if [ $details = 1 ]; then
                # run config test and display report (status action)
-               show "Checking %s configuration" "DHCP Server"; busy; echo
-               configtest
+               show "Checking %s configuration" "DHCP Server"; busy
+               local out
+               out=$(configtest 2>&1)
                RETVAL=$?
+               if [ $RETVAL = 0 ]; then
+                       ok
+               else
+                       fail
+               fi
+               [ "$out" ] && echo >&2 "$out"
        else
                # run config test and abort with nice message if failed
                # (for actions checking status before action).
@@ -68,7 +72,7 @@ checkconfig() {
                RETVAL=$?
                if [ $RETVAL != 0 ]; then
                        show "Checking %s configuration" "DHCP Server"; fail
-                       echo >&2 "Configuration test failed. Run \"$0 checkconfig\" to see errors."
+                       nls 'Configuration test failed. See details with %s "checkconfig"' $0
                        exit $RETVAL
                fi
        fi
@@ -83,7 +87,7 @@ start() {
 
        checkconfig
        msg_starting "DHCP Server"
-       daemon /sbin/dhcpd $DHCPD_INTERFACES
+       daemon /sbin/dhcpd -q $DHCPD_INTERFACES
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
 }
@@ -130,7 +134,7 @@ case "$1" in
   force-reload)
        condrestart 7
        ;;
-  checkconfig)
+  checkconfig|configtest)
        checkconfig 1
        ;;
   status)
This page took 0.117005 seconds and 4 git commands to generate.