wait for file change before continuing

This commit is contained in:
Heavybullets8 2022-08-10 23:27:11 -06:00
parent 4e61789347
commit 5888efa3d7

View File

@ -210,8 +210,18 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then
# [[ ! -e trigger ]] && touch trigger && sleep 10 # [[ ! -e trigger ]] && touch trigger && sleep 10
while true while true
do 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}') status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}')
(( count++ ))
if [[ "$status" == "ACTIVE" ]]; then if [[ "$status" == "ACTIVE" ]]; then
if [[ "$startstatus" == "STOPPED" ]]; 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 [[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Active..") && sleep 10 && continue #if reports active on FIRST time through loop, double check