Blob Blame History Raw
From 3f8de2285a40f764c800de0ed4e4a7b0f8817656 Mon Sep 17 00:00:00 2001
From: Ricky Zhou <rzhou@redhat.com>
Date: Fri, 18 Jun 2010 14:02:02 +0400
Subject: [PATCH 4/6] Fix initscript return codes

See this rhbz for the details:
https://bugzilla.redhat.com/show_bug.cgi?id=567141
---
 init-script.in |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/init-script.in b/init-script.in
index 720a96d..186c757 100644
--- a/init-script.in
+++ b/init-script.in
@@ -36,21 +36,25 @@ NrpeBin=@bindir@/nrpe
 NrpeCfg=@sysconfdir@/nrpe.cfg
 LockFile=/var/lock/subsys/nrpe
 
+RETVAL=0
+
 # See how we were called.
 case "$1" in
   start)
 	# Start daemons.
 	echo -n "Starting nrpe: "
 	daemon $NrpeBin -c $NrpeCfg -d $NRPE_SSL_OPT
+	RETVAL=$?
 	echo
-	touch $LockFile
+	[ $RETVAL = 0 ] && touch $LockFile
 	;;
   stop)
 	# Stop daemons.
 	echo -n "Shutting down nrpe: "
 	killproc nrpe
+	RETVAL=$?
 	echo
-	rm -f $LockFile
+	[ $RETVAL = 0 ] && rm -f $LockFile
 	;;
   restart)
 	$0 stop
@@ -59,14 +63,16 @@ case "$1" in
   reload)
 	echo -n "Reloading nrpe"
 	killproc nrpe -HUP
+	RETVAL=$?
 	echo
 	;;
   status)
 	status nrpe
+	RETVAL=$?
 	;;
   *)
 	echo "Usage: nrpe {start|stop|restart|reload|status}"
-	exit 1
+	RETVAL=2
 esac
 
-exit 0
+exit $RETVAL
-- 
1.6.6.1