commit af161e18fbf58669ba1d6dca6de20fd211bd4b76
Author: Pete Zaitcev <zaitcev(a)redhat.com>
Date: Wed Sep 14 16:22:47 2011 +0200
make iwhd's startup script report failure reliably
iwhd's startup script would mistakenly exit successfully even
though it failed, e.g., because it failed to find a usable
instance of Mongo.
* iwhd.init.in (start, stop): Return success indicator.
(main): Propagate success/failure from case stmt to script "exit".
* NEWS (Bug fixes): Mention it.
NEWS | 5 +++++
iwhd.init.in | 7 +++++--
2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index c827c0e..be681f9 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,11 @@ iwhd NEWS -*- outline
-*-
** Bug fixes
+ iwhd's /etc/init.d startup script now reports failure reliably, for
+ example when failing to start because no MongoDB server is running.
+ Before it would print [FAILED], but mistakenly exit 0 (successful).
+ Now it exits with status 1.
+
Adapt to a slight variation in the status report of a template import
action in RHEV-M 2.x.
diff --git a/iwhd.init.in b/iwhd.init.in
index 306fcf7..9a7d9b6 100644
--- a/iwhd.init.in
+++ b/iwhd.init.in
@@ -89,6 +89,7 @@ start() {
failure
fi
echo
+ return $RETVAL
}
stop() {
@@ -99,6 +100,7 @@ stop() {
rm -f $PIDFILE
rm -rf @localstatedir@/cache/iwhd/*
fi
+ return $RETVAL
}
restart() {
@@ -122,7 +124,6 @@ case "$1" in
;;
status)
status -p $PIDFILE $PROCESS
- RETVAL=$?
;;
force-reload)
reload
@@ -135,4 +136,6 @@ case "$1" in
exit 2
;;
esac
-exit $RETVAL
+
+# Exit with the result of the "case" statement.
+exit $?
Show replies by date