From 5888efa3d7a62af7bffe75556b2d70749d3a2da7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 23:27:11 -0600 Subject: [PATCH] wait for file change before continuing --- functions/update_apps.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 95b9030a..28801d9d 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -210,8 +210,18 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then # [[ ! -e trigger ]] && touch trigger && sleep 10 while true do - (( count++ )) + if [[ $count -lt 1 ]]; then + while_count=$(head -n 1 temp.txt) + else + until [[ $while_count -lt $current_count ]] # Wait for a change in the file BEFORE continuing + do + current_count=$(head -n 1 temp.txt) + sleep 2 + done + while_count=$current_count + fi status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}') + (( count++ )) if [[ "$status" == "ACTIVE" ]]; then if [[ "$startstatus" == "STOPPED" ]]; then [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check