From 001c875d02303e4b049f214ab72338e555b34a20 Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Tue, 15 Mar 2016 14:51:40 +0000 Subject: [PATCH] Updated aws start/stop scripts to handle multiple start/stop scripts Primarily to handle the two celery processes --- scripts/aws_start_app.sh | 19 +++++++++++++++++-- scripts/aws_stop_app.sh | 32 ++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/scripts/aws_start_app.sh b/scripts/aws_start_app.sh index 40bd7d50e..7be657a03 100755 --- a/scripts/aws_start_app.sh +++ b/scripts/aws_start_app.sh @@ -1,4 +1,19 @@ #!/bin/bash -echo "Starting application" -sudo service notifications-api start \ No newline at end of file +if [ -e "/etc/init/notifications-api.conf" ] +then + echo "Starting api" + sudo service notifications-api start +fi + +if [ -e "/etc/init/notifications-api-celery-worker.conf" ] +then + echo "Starting celery worker" + sudo service notifications-api-celery-worker start +fi + +if [ -e "/etc/init/notifications-api-celery-beat.conf" ] +then + echo "Starting celery beat" + sudo service notifications-api-celery-beat start +fi diff --git a/scripts/aws_stop_app.sh b/scripts/aws_stop_app.sh index 188467062..2f5660ae1 100755 --- a/scripts/aws_stop_app.sh +++ b/scripts/aws_stop_app.sh @@ -7,9 +7,29 @@ function error_exit exit 0 } -echo "Stopping application" -if sudo service notifications-api stop; then - exit 0 -else - error_exit "Could not stop application" -fi \ No newline at end of file +if [ -e "/etc/init/notifications-api.conf" ]; then + echo "stopping notifications-api" + if sudo service notifications-api stop; then + echo "notifications-api stopped" + else + error_exit "Could not stop notifications-api" + fi +fi + +if [ -e "/etc/init/notifications-api-celery-beat.conf" ]; then + echo "stopping notifications-api-celery-beat" + if sudo service notifications-api-celery-beat stop; then + echo "notifications-api stopped" + else + error_exit "Could not stop notifications-celery-beat" + fi +fi + +if [ -e "/etc/init/notifications-api-celery-worker.conf" ]; then + echo "stopping notifications-api-celery-worker" + if sudo service notifications-api-celery-worker stop; then + echo "notifications-api stopped" + else + error_exit "Could not stop notifications-celery-worker" + fi +fi