From 19d52e058a6deb4b26d0c2f6a8b83663a4405cdc Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 4 Sep 2022 17:23:22 -0600 Subject: [PATCH] add sleep to while loop --- functions/update_apps.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index a0d286e1..e128e12b 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -96,6 +96,20 @@ if ! grep -qs "^$app_name," external_services ; then fi fi +# If application is deploying prior to updating, attempt to wait for it to finish +if [[ "$startstatus" == "DEPLOYING" ]]; then + SECONDS=0 + while [[ "$status" == "DEPLOYING" ]] + do + status=$(grep "^$app_name," all_app_status | awk -F ',' '{print $2}') + if [[ "$SECONDS" -ge "$timeout" ]]; then + echo_array+=("Application is stuck Deploying, Skipping to avoid damage") + return + fi + sleep 5 + done +fi + # If user is using -S, stop app prior to updating echo_array+=("\n$app_name") if [[ $stop_before_update == "true" && "$startstatus" != "STOPPED" ]]; then # Check to see if user is using -S or not