From 0175a6ab51b221b20337b5fa35515d12fc5465fe Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 1 May 2015 12:17:05 -0400 Subject: [PATCH] eg-updater gracefully handles apache not running Before, the script would exit because the apache stop command would return non-zero. Includes minor wording changes. Signed-off-by: Bill Erickson --- KCLS/admin-scripts/eg-updater.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/KCLS/admin-scripts/eg-updater.sh b/KCLS/admin-scripts/eg-updater.sh index 4e24cf6f78..0705cbe130 100755 --- a/KCLS/admin-scripts/eg-updater.sh +++ b/KCLS/admin-scripts/eg-updater.sh @@ -551,7 +551,7 @@ inspect_params; if [ -n "$DETACH_NEEDED" ]; then if [ ! -f $PING_FILE ]; then - announce "No ping file found. Skipping detach." + announce "No ping file found." else announce "Detaching brick" @@ -583,8 +583,16 @@ elif [ -n "$DETACH_ONLY" ]; then elif [ -z "$ATTACH_ONLY" ]; then if [ -z "$SKIP_APACHE" -a -z "$START_ONLY" ]; then - announce "Stopping Apache" - sudo service apache2 stop > /dev/null + set +e # temporarily disable exit-on-error setting + service apache2 status 2>&1 > /dev/null + stat=$? + set -e + if [ $stat -eq 0 ]; then # apache running + announce "Stopping Apache" + sudo service apache2 stop > /dev/null + else + announce "Apache not running" + fi fi # Note the use of --fast-shutdown-all, which is faster than the -- 2.11.0