From c7079cf338992b2a574159d5872aa3510edef763 Mon Sep 17 00:00:00 2001 From: James Laska Date: Mon, 17 Nov 2014 13:25:33 -0500 Subject: [PATCH] Wait when stopping supervisor Fixes a problem where we issue a start before supervisor has cleaned up child pids (Ubuntu only). Trello: https://trello.com/c/5rOxYcY5 --- tools/scripts/ansible-tower | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/scripts/ansible-tower b/tools/scripts/ansible-tower index 8b315428d0..f124ac5009 100755 --- a/tools/scripts/ansible-tower +++ b/tools/scripts/ansible-tower @@ -25,11 +25,16 @@ fi service_action() { for svc in ${SERVICES[@]}; do - service ${svc} $1 - this_return=$? - if [ $this_return -gt $worst_return ]; then - worst_return=$this_return - fi + service ${svc} $1 + this_return=$? + if [ $this_return -gt $worst_return ]; then + worst_return=$this_return + fi + # Allow supervisor time to cleanup child pids (ubuntu only) + if [[ ${svc} == supervisor* && ${1} == stop && -e /etc/debian_version ]]; then + echo "Waiting to allow supervisor time to cleanup ..." + sleep 5 + fi done }