[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/bind/FC-3 named.init,1.23,1.24



Author: jvdias

Update of /cvs/dist/rpms/bind/FC-3
In directory cvs.devel.redhat.com:/tmp/cvs-serv16673

Modified Files:
	named.init 
Log Message:
fix bugs 151852, 155848 157601


Index: named.init
===================================================================
RCS file: /cvs/dist/rpms/bind/FC-3/named.init,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- named.init	22 Mar 2005 21:54:41 -0000	1.23
+++ named.init	12 Jul 2005 22:13:32 -0000	1.24
@@ -26,14 +26,15 @@
 
 [ -r ${ROOTDIR}/etc/named.conf ] || exit 1
 
-
 start() {
         # Start daemons.
+        echo -n $"Starting $prog: "
 	if [ -n "`/sbin/pidof named`" ]; then
 		echo -n $"$prog: already running"
+		failure
+		echo
 		return 1
 	fi
-        echo -n $"Starting $prog: "
 	ckcf_options='';
 	if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
 		OPTIONS="${OPTIONS} -t ${ROOTDIR}"
@@ -86,14 +87,19 @@
 	if [ $conf_ok -eq 1 ]; then	   
 	   daemon /usr/sbin/$PROG -u named ${OPTIONS};
 	   RETVAL=$?;
-	else
-	   named_err=`/usr/sbin/named -g 2>&1 | sed s/\n/\\n/g`;
-	   if [ `tty` != "/dev/console" ]; then
-	       echo -e "\n$named_err";
-	       echo -n  "Error in configuration file /etc/named.conf : ";
+	   if [ $RETVAL -eq 0 ]; then
+	       ln -s $ROOTDIR/var/run/named/named.pid /var/run/named.pid;
 	   fi;
-           failure $"Error in configuration file /etc/named.conf : $named_err";
-           echo
+	else
+	   named_err="`/usr/sbin/named-checkconf $ckcf_options 2>&1`";	   
+	   echo
+	   echo $"Error in named configuration"':';
+	   echo "$named_err";
+	   failure
+	   echo
+	   if [ -x /usr/bin/logger ]; then
+	       echo "$named_err" | /usr/bin/logger -pdaemon.error -tnamed 
+           fi;
            return $RETVAL;
         fi;
  	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/named 
@@ -103,19 +109,25 @@
 stop() {
         # Stop daemons.
         echo -n $"Stopping $prog: "
-	/usr/sbin/rndc stop >/dev/null 2>&1
+	/usr/sbin/rndc stop >/dev/null 2>&1 || pidof named >/dev/null && killproc named -TERM >/dev/null 2>&1
 	RETVAL=$?
-	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named || {
-#        	killproc named 
-#               Never do this! Can cause corrupt zone files!
-	        /usr/sbin/rndc stop >/dev/null 2>&1
-		RETVAL=$?
-		[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named
-		echo
-		return $RETVAL 
-	}
-	success
-        echo
+	if [ $RETVAL -eq 0 ]; then
+	    rm -f /var/lock/subsys/named
+	    rm -f /var/run/named.pid	    
+	elif  pidof named >/dev/null; then
+	    /usr/sbin/rndc stop >/dev/null 2>&1 || pidof named >/dev/null && killproc named -TERM >/dev/null 2>&1
+	    RETVAL=$?
+	    if [ $RETVAL -eq 0 ]; then
+		rm -f /var/lock/subsys/named
+		rm -f /var/run/named.pid
+	    fi;
+	fi;
+	if [ $RETVAL -eq 0 ]; then
+	    success
+	else
+	    failure
+        fi;
+	echo
 	return $RETVAL
 }
 rhstatus() {
@@ -145,7 +157,19 @@
 	# to offer to restart every time
 	/usr/sbin/rndc reload >/dev/null 2>&1 || echo start
 	return $?
-}  
+}
+checkconfig() {
+        ckcf_options='';
+	if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
+		OPTIONS="${OPTIONS} -t ${ROOTDIR}"
+		ckcf_options="$ckcf_options -t ${ROOTDIR}";  
+	fi;
+	if [ -x /usr/sbin/named-checkconf ] && [ -x /usr/sbin/named-checkzone ] && /usr/sbin/named-checkconf $ckcf_options ; then
+	    return 0;
+	else
+	    return 1;
+	fi
+}
 
 # See how we were called.
 case "$1" in
@@ -170,6 +194,9 @@
 	probe)
 		probe
 		;;
+        checkconfig)
+	        checkconfig
+		;;
 	*)
         	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|probe}"
 		exit 1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]