Merge pull request #24 from Heavybullets8/commander-update

-Simplified commander function
This commit is contained in:
Heavybullets8 2022-09-04 23:58:23 +00:00 committed by GitHub
commit aa20c65a34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@ it=0
while_count=0
rm deploying 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
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++))
@ -38,16 +38,12 @@ do
kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); }
((count++))
done
if [[ "$proc_count" -ge "$update_limit" ]]; then
sleep 3
elif [[ $it -lt ${#array[@]} ]]; then
if [[ $it -lt ${#array[@]} && "$proc_count" -lt "$update_limit" ]]; then
pre_process "${array[$it]}" &
processes+=($!)
((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
else # All processes must be completed, break out of loop
break
fi
done
rm deploying 2>/dev/null