]> git.pld-linux.org Git - packages/dhcp.git/commitdiff
- check for config syntax
authorElan Ruusamäe <glen@pld-linux.org>
Mon, 22 Jan 2007 17:38:56 +0000 (17:38 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    dhcp.init -> 1.16

dhcp.init

index e0726627cb347bdfc41604042961d6a5714859b4..89ee292550981a12029c515b094be36139609fd2 100644 (file)
--- a/dhcp.init
+++ b/dhcp.init
@@ -23,6 +23,18 @@ else
        exit 0
 fi
 
+checkconfig() {
+       show "Checking %s configuration" DHCPD
+       out=`/usr/sbin/dhcpd -t 2>&1`; rc=$?
+       if [ $rc -gt 0 ]; then
+               fail
+               echo >&2 "$out"
+       else
+               ok
+       fi
+       return $rc
+}
+
 start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/dhcpd ]; then
@@ -49,21 +61,26 @@ RETVAL=0
 # See how we were called.
 case "$1" in
   start)
+       checkconfig || exit 1
        start
        ;;
   stop)
        stop
        ;;
   restart)
+       checkconfig || exit 1
        stop
        start
        ;;
+  checkconfig)
+       checkconfig
+       ;;
   status)
        status dhcpd
        exit $?
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|status}"
+       msg_usage "$0 {start|stop|restart|checkconfig|status}"
        exit 3
 esac
 
This page took 0.106555 seconds and 4 git commands to generate.