From b8b15234bcf3fc4edecf219e2c3331e9eee54b17 Mon Sep 17 00:00:00 2001 From: Michael Fenn Date: Thu, 28 Mar 2013 09:36:21 -0400 Subject: 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. --- debian/bcfg2-server.init | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'debian/bcfg2-server.init') 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 -- cgit v1.2.3-1-g7c22