Hi,

We try to ensure that nagios is not running on our machines.
Unfortunately this results
in errors like
--
err: //nagios/Service[nagios]/ensure: change from running to stopped
failed: Could not stop Service[nagios]: Execution of '/sbin/service
nagios stop' returned 1:  at /etc/puppet/modules/nagios/manifests/init.pp:10
--

The Problem is, that service nagio stop returns error 1. This is caused
by the pid_nagios function.

The two patches should correct this.

Please have a look at this.

thx and regards,

-- 
Thomas Heil
-
! note my new number !
Skype: phiber.sun
Email: [email protected]
Tel:   0176 / 44555622
--


--- nagios-3.2.1/daemon-init.in	2010-05-07 16:01:06.000000000 +0200
+++ nagios-3.2.1/daemon-init.in	2010-05-07 15:55:54.000000000 +0200
@@ -72,9 +72,14 @@
 pid_nagios ()
 {
 
+EXIT_CODE=1
+if [[ $1 == "stop" ]]; then	
+	EXIT_CODE=0
+fi
+
 	if test ! -f $NagiosRunFile; then
 		echo "No lock file found in $NagiosRunFile"
-		exit 1
+		exit $EXIT_CODE
 	fi
 
 	NagiosPID=`head -n 1 $NagiosRunFile`
@@ -141,7 +146,7 @@
 	stop)
 		echo -n "Stopping nagios: "
 
-		pid_nagios
+		pid_nagios stop
 		killproc_nagios nagios
 
  		# now we have to wait for nagios to exit and remove its

--- a/nagios.spec	2010-03-22 00:00:40.000000000 +0100
+++ b/nagios.spec	2010-05-07 16:20:31.000000000 +0200
@@ -26,6 +26,7 @@
 
 Source0: http://dl.sf.net/nagios/nagios-%{version}.tar.gz
 Source1: http://dl.sf.net/nagios/imagepak-base.tar.gz
+Patch1: nagios-stop-pid-no_error.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 
 BuildRequires: gd-devel > 1.8
@@ -61,6 +62,8 @@
 %prep
 %setup
 
+%patch1 -p1 
+
 # /usr/local/nagios is hardcoded in many places
 %{__perl} -pi.orig -e 's|/usr/local/nagios/var/rw|%{_localstatedir}/nagios/rw|g;' contrib/eventhandlers/submit_check_result
 

_______________________________________________
suggest mailing list
[email protected]
http://lists.rpmforge.net/mailman/listinfo/suggest

Reply via email to