From e41bce1404c055a6c2e9c17fcf89443142fc552b 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/8] Fix initscript return codes
See this rhbz for the details:
https://bugzilla.redhat.com/show_bug.cgi?id=567141
---
startup/default-init.in | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/startup/default-init.in b/startup/default-init.in
index 720a96d..186c757 100644
--- a/startup/default-init.in
+++ b/startup/default-init.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.8.3.1