replace while true

This commit is contained in:
Heavybullets8 2022-09-04 17:40:29 -06:00
parent cc9091de15
commit b1f6b01e61

View File

@ -13,7 +13,7 @@ it=0
while_count=0 while_count=0
rm deploying 2>/dev/null rm deploying 2>/dev/null
rm finished 2>/dev/null rm finished 2>/dev/null
while true while [[ $proc_count != 0 || $(wc -l finished 2>/dev/null | awk '{ print $1 }') -lt "${#array[@]}" ]]
do do
if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' 2>/dev/null) ; then if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,container_images_update_available,status' 2>/dev/null) ; then
((while_count++)) ((while_count++))
@ -38,16 +38,12 @@ do
kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); }
((count++)) ((count++))
done done
if [[ "$proc_count" -ge "$update_limit" ]]; then if [[ $it -lt ${#array[@]} && "$proc_count" -lt "$update_limit" ]]; then
sleep 3
elif [[ $it -lt ${#array[@]} ]]; then
pre_process "${array[$it]}" & pre_process "${array[$it]}" &
processes+=($!) processes+=($!)
((it++)) ((it++))
elif [[ $proc_count != 0 || $(wc -l finished 2>/dev/null | awk '{ print $1 }') -lt "${#array[@]}" ]]; then # Wait for all processes to finish else
sleep 3 sleep 3
else # All processes must be completed, break out of loop
break
fi fi
done done
rm deploying 2>/dev/null rm deploying 2>/dev/null