[packages/nagios] - use --pidfile when reporting status or reloading, so nagios child processes do not get into way

glen glen at pld-linux.org
Sat Mar 9 19:14:16 CET 2013


commit d12528d93214ef67e74231b8052e65c47e7314fa
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Wed Dec 5 22:56:16 2012 +0200

    - use --pidfile when reporting status or reloading, so nagios child processes do not get into way

 nagios.init | 10 +++++++---
 nagios.spec |  4 ++--
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/nagios.spec b/nagios.spec
index 0955580..085e7cb 100644
--- a/nagios.spec
+++ b/nagios.spec
@@ -28,7 +28,7 @@ Source6:	http://www.google.com/mapfiles/shadow50.png
 Source7:	http://www.google.com/mapfiles/marker.png
 # Source7-md5:	edefef4bdfc29e1c953694651f05b466
 Source8:	googlemap.js
-Source9:	nagioswall.php
+Source9:	%{name}wall.php
 Patch0:		%{name}-resources.patch
 Patch1:		%{name}-iconv-in-libc.patch
 Patch2:		%{name}-webapps.patch
@@ -57,7 +57,7 @@ BuildRequires:	perl-Test-WWW-Mechanize-CGI
 %endif
 Requires(post,preun):	/sbin/chkconfig
 Requires:	%{name}-common = %{version}-%{release}
-Requires:	rc-scripts
+Requires:	rc-scripts >= 0.4.5.5
 Requires:	sh-utils
 Suggests:	nagios-notify >= 0.13
 Suggests:	nagios-plugin-check_load
diff --git a/nagios.init b/nagios.init
old mode 100644
new mode 100755
index d9d0a18..cf6348f
--- a/nagios.init
+++ b/nagios.init
@@ -30,6 +30,10 @@ cfg_file=/etc/nagios/nagios.cfg
 # check for precache
 precached_object_file=$(awk -F= '/^precached_object_file/{print $2}' $cfg_file)
 
+# nagios pid file
+pid_file=$(awk -F= '/^lock_file/{print $2}' $cfg_file)
+pid_file=${pid_file:-/var/lib/nagios/nagios.pid}
+
 # configtest itself
 configtest() {
 	/usr/sbin/nagios ${precached_object_file:+-p} -v $cfg_file
@@ -94,7 +98,7 @@ stop() {
 	fi
 
 	msg_stopping "Nagios"
-	killproc nagios -TERM
+	killproc --pidfile $pid_file nagios
 	rm -f /var/lock/subsys/nagios > /dev/null 2>&1
 }
 
@@ -109,7 +113,7 @@ reload() {
 	msg_reloading "Nagios"
 
 	# NOTE: precached object file is created in configtest.
-	killproc nagios -HUP
+	killproc --pidfile $pid_file nagios -HUP
 	RETVAL=$?
 }
 
@@ -149,7 +153,7 @@ case "$1" in
 	checkconfig 1
 	;;
   status)
-	status nagios
+	status --pidfile $pid_file nagios
 	RETVAL=$?
 	;;
 *)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/nagios.git/commitdiff/d12528d93214ef67e74231b8052e65c47e7314fa



More information about the pld-cvs-commit mailing list