packages: nagios/nagios.init, nagios/nagios.spec - use precache if enabled, ...

glen glen at pld-linux.org
Mon Aug 3 19:21:47 CEST 2009


Author: glen                         Date: Mon Aug  3 17:21:47 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- use precache if enabled, see http://nagios.sourceforge.net/docs/3_0/faststartup.html

---- Files affected:
packages/nagios:
   nagios.init (1.22 -> 1.23) , nagios.spec (1.129 -> 1.130) 

---- Diffs:

================================================================
Index: packages/nagios/nagios.init
diff -u packages/nagios/nagios.init:1.22 packages/nagios/nagios.init:1.23
--- packages/nagios/nagios.init:1.22	Sat Jul 25 21:46:47 2009
+++ packages/nagios/nagios.init	Mon Aug  3 19:21:42 2009
@@ -25,10 +25,14 @@
 	exit 0
 fi
 
+cfg_file=/etc/nagios/nagios.cfg
+
+# check for precache
+precached_object_file=$(awk -F= '/^precached_object_file/{print $2}' $cfg_file)
+
 # configtest itself
 configtest() {
-	/usr/sbin/nagios -v /etc/nagios/nagios.cfg 2>&1
-	return $?
+	/usr/sbin/nagios ${precached_object_file:+-p} -v $cfg_file
 }
 
 # wrapper for configtest:
@@ -72,7 +76,10 @@
 
 	# remove stale cmd pipe (or nagios won't start if it exists)
 	rm -f /var/lib/nagios/rw/nagios.cmd
-	daemon /usr/sbin/nagios -d /etc/nagios/nagios.cfg </dev/null
+
+	# we're safe to use -x as we did verify config prior startup
+	# precached object file also is created in configtest.
+	daemon /usr/sbin/nagios ${precached_object_file:+-u} -d $cfg_file
 	RETVAL=$?
 	if [ $RETVAL -eq 0 ]; then
 		touch /var/lock/subsys/nagios
@@ -101,6 +108,7 @@
 	checkconfig
 	msg_reloading "Nagios"
 
+	# NOTE: precached object file is created in configtest.
 	killproc nagios -HUP
 	RETVAL=$?
 }

================================================================
Index: packages/nagios/nagios.spec
diff -u packages/nagios/nagios.spec:1.129 packages/nagios/nagios.spec:1.130
--- packages/nagios/nagios.spec:1.129	Mon Aug  3 18:56:09 2009
+++ packages/nagios/nagios.spec	Mon Aug  3 19:21:42 2009
@@ -269,7 +269,7 @@
 find $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} -name '*.in' | xargs rm
 
 # Object data/cache files
-for i in {objects.cache,{comments,downtime,retention,status}.dat,nagios.tmp}; do
+for i in {objects.{cache,precache},{comments,downtime,retention,status}.dat,nagios.tmp}; do
 	> $RPM_BUILD_ROOT%{_localstatedir}/$i
 done
 > $RPM_BUILD_ROOT%{_localstatedir}/rw/nagios.cmd
@@ -278,7 +278,7 @@
 rm -rf $RPM_BUILD_ROOT
 
 %post
-for i in %{_localstatedir}/{objects.cache,{comments,downtime,retention,status}.dat}; do
+for i in %{_localstatedir}/{objects.{cache,precache},{comments,downtime,retention,status}.dat}; do
 	[ ! -f $i ] && touch $i
 	chown root:nagios $i
 	chmod 664 $i
@@ -374,6 +374,7 @@
 %attr(2770,root,nagios-data) %dir %{_localstatedir}/spool
 %attr(2770,root,nagios-data) %dir %{_localstatedir}/spool/checkresults
 %attr(664,root,nagios) %ghost %{_localstatedir}/objects.cache
+%attr(664,root,nagios) %ghost %{_localstatedir}/objects.precache
 %attr(664,root,nagios) %ghost %{_localstatedir}/*.dat
 %attr(664,root,nagios) %ghost %{_localstatedir}/%{name}.tmp
 
@@ -435,6 +436,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.130  2009/08/03 17:21:42  glen
+- use precache if enabled, see http://nagios.sourceforge.net/docs/3_0/faststartup.html
+
 Revision 1.129  2009/08/03 16:56:09  glen
 - recover dependencies.cfg
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios/nagios.init?r1=1.22&r2=1.23&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios/nagios.spec?r1=1.129&r2=1.130&f=u



More information about the pld-cvs-commit mailing list