summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Fenn <fennm@deshawresearch.com>2013-03-28 09:36:21 -0400
committerMichael Fenn <fennm@deshawresearch.com>2013-03-28 09:36:21 -0400
commitb1cd0e1d5b935ca1f3934930e83ea69acca77fb4 (patch)
tree5238e8d5b886d53aacc29ff580d2b9891744e589
parentaacbd15de9d6985dba876337547d73fb4cabfacb (diff)
downloadbcfg2-b1cd0e1d5b935ca1f3934930e83ea69acca77fb4.tar.gz
bcfg2-b1cd0e1d5b935ca1f3934930e83ea69acca77fb4.tar.bz2
bcfg2-b1cd0e1d5b935ca1f3934930e83ea69acca77fb4.zip
Pass through retval from start, stop, status, etc.
The various init scripts have the usual start, stop, and status functions which are called from a case statement. The functions even nicely return various values for success and failure. Unfortunately, those values were not passed all the way back to the calling shell. Previously, the init scripts would return 0 if any of start, stop, or status failed. This commit ensures that they they pass the return value back to the caller. Why does this matter? Well, beyond just being generally good citizens, bcfg2's own chkconfig client tool expects stopped services to return a non-zero exit code when their status function is called. Otherwise it flags the service state as incorrect and tries to stop it on every run.
-rwxr-xr-xdebian/bcfg2-report-collector.init9
-rwxr-xr-xdebian/bcfg2-server.init9
-rwxr-xr-xdebian/bcfg2.init9
-rwxr-xr-xredhat/scripts/bcfg2-report-collector.init9
-rwxr-xr-xredhat/scripts/bcfg2-server.init3
-rwxr-xr-xredhat/scripts/bcfg2.init4
6 files changed, 33 insertions, 10 deletions
diff --git a/debian/bcfg2-report-collector.init b/debian/bcfg2-report-collector.init
index 2d182385a..df7b751cb 100755
--- a/debian/bcfg2-report-collector.init
+++ b/debian/bcfg2-report-collector.init
@@ -32,6 +32,7 @@ test -x $DAEMON || exit 5
# Internal variables
BINARY=$(basename $DAEMON)
+RETVAL=0
start () {
echo -n "Starting Configuration Report Collector: "
@@ -85,22 +86,26 @@ status () {
case "$1" in
start)
start
+ RETVAL=$?
;;
stop)
stop
+ RETVAL=$?
;;
status)
status
+ RETVAL=$?
;;
restart|reload|force-reload)
stop
sleep 5
start
+ RETVAL=$?
;;
*)
log_success_msg "Usage: $0 {start|stop|status|reload|restart|force-reload}"
- exit 1
+ RETVAL=1
;;
esac
-exit 0
+exit $RETVAL
diff --git a/debian/bcfg2-server.init b/debian/bcfg2-server.init
index 8de16b9b5..04774c063 100755
--- a/debian/bcfg2-server.init
+++ b/debian/bcfg2-server.init
@@ -41,6 +41,7 @@ test -x $DAEMON || exit 5
# Internal variables
BINARY=$(basename $DAEMON)
+RETVAL=0
start () {
echo -n "Starting Configuration Management Server: "
@@ -91,22 +92,26 @@ status () {
case "$1" in
start)
start
+ RETVAL=$?
;;
stop)
stop
+ RETVAL=$?
;;
status)
status
+ RETVAL=$?
;;
restart|reload|force-reload)
stop
sleep 5
start
+ RETVAL=$?
;;
*)
log_success_msg "Usage: $0 {start|stop|status|reload|restart|force-reload}"
- exit 1
+ RETVAL=1
;;
esac
-exit 0
+exit $RETVAL
diff --git a/debian/bcfg2.init b/debian/bcfg2.init
index 4f83adbf6..b2e47b346 100755
--- a/debian/bcfg2.init
+++ b/debian/bcfg2.init
@@ -47,6 +47,7 @@ fi
# Internal variables
BINARY=$(basename $BCFG2)
+RETVAL=0
# Include lsb functions
. /lib/lsb/init-functions
@@ -70,17 +71,19 @@ start () {
case "$1" in
start)
start
+ RETVAL=$?
;;
stop|status)
- exit 0
+ RETVAL=0
;;
restart|force-reload)
start
+ RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|status|restart|force-reload}"
- exit 1
+ RETVAL=1
;;
esac
-exit 0
+exit $RETVAL
diff --git a/redhat/scripts/bcfg2-report-collector.init b/redhat/scripts/bcfg2-report-collector.init
index a8e23f080..43e875a6b 100755
--- a/redhat/scripts/bcfg2-report-collector.init
+++ b/redhat/scripts/bcfg2-report-collector.init
@@ -32,6 +32,7 @@ test -x $DAEMON || exit 5
# Internal variables
BINARY=$(basename $DAEMON)
+RETVAL=0
start () {
echo -n "Starting Configuration Report Collector: "
@@ -79,22 +80,26 @@ status () {
case "$1" in
start)
start
+ RETVAL=$?
;;
stop)
stop
+ RETVAL=$?
;;
status)
status
+ RETVAL=$?
;;
restart|reload|force-reload)
stop
sleep 5
start
+ RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|status|reload|restart|force-reload}"
- exit 1
+ RETVAL=1
;;
esac
-exit 0
+exit $RETVAL
diff --git a/redhat/scripts/bcfg2-server.init b/redhat/scripts/bcfg2-server.init
index ffac6ac3d..c4412d1c3 100755
--- a/redhat/scripts/bcfg2-server.init
+++ b/redhat/scripts/bcfg2-server.init
@@ -59,9 +59,11 @@ stop () {
case "$1" in
start)
start
+ RETVAL=$?
;;
stop)
stop
+ RETVAL=$?
;;
status)
status $prog
@@ -71,6 +73,7 @@ case "$1" in
stop
sleep 5
start
+ RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
diff --git a/redhat/scripts/bcfg2.init b/redhat/scripts/bcfg2.init
index 5cfdf47bc..9c26434ff 100755
--- a/redhat/scripts/bcfg2.init
+++ b/redhat/scripts/bcfg2.init
@@ -54,12 +54,14 @@ start () {
case "$1" in
start)
start
+ RETVAL=$?
;;
stop|status)
- exit 0
+ RETVAL=0
;;
restart|force-reload)
start
+ RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|status|restart|force-reload}"