From 5ae632e7eacb7ff625d671d02d654846b206b424 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 24 May 2016 11:36:36 -0400 Subject: [PATCH] eg-updater.sh: Apache control repairs/additions 1. If apache is already running when start-apache is called, stop it first. This is useful when calling start-apache (or start-all) directly after a reboot, where Apache may have started automatically at boot. 2. Force a call to 'detach' when stop-apache is called directly as a safety measure. Signed-off-by: Bill Erickson --- KCLS/admin-scripts/eg-updater.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/KCLS/admin-scripts/eg-updater.sh b/KCLS/admin-scripts/eg-updater.sh index 774ab501ce..eee5413fef 100755 --- a/KCLS/admin-scripts/eg-updater.sh +++ b/KCLS/admin-scripts/eg-updater.sh @@ -180,6 +180,10 @@ function inspect_params { ACTIONS="$ACTIONS,detach,stop-apache,stop-eg"; fi + if [[ "$ACTIONS" =~ "stop-apache" ]]; then + ACTIONS="$ACTIONS,detach"; + fi + if [[ "$ACTIONS" =~ "deploy-all" ]]; then ACTIONS="$ACTIONS,update-eg,deploy-eg"; fi @@ -662,6 +666,15 @@ if [[ "$ACTIONS" =~ "start-eg" ]]; then fi if [[ "$ACTIONS" =~ "start-apache" ]]; then + 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 "Apache is already running. Stopping first..." + sudo service apache2 stop > /dev/null + sleep 3; + fi announce "Starting Apache" sudo service apache2 start > /dev/null fi -- 2.11.0