SOURCES: dhcp.init - check for config syntax

glen glen at pld-linux.org
Mon Jan 22 18:39:02 CET 2007


Author: glen                         Date: Mon Jan 22 17:39:01 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- check for config syntax

---- Files affected:
SOURCES:
   dhcp.init (1.15 -> 1.16) 

---- Diffs:

================================================================
Index: SOURCES/dhcp.init
diff -u SOURCES/dhcp.init:1.15 SOURCES/dhcp.init:1.16
--- SOURCES/dhcp.init:1.15	Mon Jan 22 18:29:44 2007
+++ SOURCES/dhcp.init	Mon Jan 22 18:38:56 2007
@@ -23,6 +23,18 @@
 	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 @@
 # 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
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/dhcp.init?r1=1.15&r2=1.16&f=u



More information about the pld-cvs-commit mailing list