Better logging of PIDs array

This commit is contained in:
Athanasios Voutsadakis
2018-02-28 14:34:48 +00:00
parent bef80e3414
commit 138d4eee25

View File

@@ -55,8 +55,7 @@ function on_exit {
break break
fi fi
echo "Terminating celery processes with pids ${APP_PIDS}" echo "Terminating celery processes with pids "${APP_PIDS}
APP_PIDS=($APP_PIDS)
for APP_PID in ${APP_PIDS}; do for APP_PID in ${APP_PIDS}; do
# if TERMINATE_TIMEOUT is reached, send SIGKILL # if TERMINATE_TIMEOUT is reached, send SIGKILL
if [[ "$n" -ge "$TERMINATE_TIMEOUT" ]]; then if [[ "$n" -ge "$TERMINATE_TIMEOUT" ]]; then
@@ -64,6 +63,7 @@ function on_exit {
kill -9 ${APP_PID} || true kill -9 ${APP_PID} || true
break break
else else
echo "Timeout not reached yet, checking " ${APP_PID}
# else, if process is still running send SIGTERM # else, if process is still running send SIGTERM
if [[ $(kill -0 ${APP_PID} 2&>/dev/null) ]]; then if [[ $(kill -0 ${APP_PID} 2&>/dev/null) ]]; then
echo "Terminating celery process with pid ${APP_PID}" echo "Terminating celery process with pid ${APP_PID}"
@@ -83,7 +83,7 @@ function get_celery_pids {
function start_application { function start_application {
eval "$@" eval "$@"
get_celery_pids get_celery_pids
echo "Application process pids: ${APP_PIDS}" echo "Application process pids: "${APP_PIDS}
} }
function start_aws_logs_agent { function start_aws_logs_agent {