return array append
This commit is contained in:
parent
33a77e0687
commit
033db8d4a5
@ -11,10 +11,12 @@ echo "Asynchronous Updates: $update_limit"
|
|||||||
|
|
||||||
proc_count=0
|
proc_count=0
|
||||||
it=0
|
it=0
|
||||||
|
ttl=0
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status')
|
while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status')
|
||||||
echo "$while_status" > temp.txt
|
echo "$while_status" > temp.txt
|
||||||
|
proc_count=${#processes[@]}
|
||||||
count=0
|
count=0
|
||||||
for proc in "${processes[@]}"
|
for proc in "${processes[@]}"
|
||||||
do
|
do
|
||||||
@ -25,15 +27,21 @@ do
|
|||||||
sleep 3
|
sleep 3
|
||||||
elif [[ $it -lt ${#array[@]} ]]; then
|
elif [[ $it -lt ${#array[@]} ]]; then
|
||||||
new_updates=0
|
new_updates=0
|
||||||
until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]]
|
until [[ "$proc_count" -eq "$update_limit" || $it -eq ${#array[@]} ]]
|
||||||
do
|
do
|
||||||
update_apps "${array[$it]}" &
|
update_apps "${array[$it]}" &
|
||||||
processes+=($!)
|
processes+=($!)
|
||||||
((proc_count++))
|
|
||||||
((it++))
|
((it++))
|
||||||
((new_updates++))
|
((new_updates++))
|
||||||
done
|
done
|
||||||
[[ $new_updates -gt 1 ]] && sleep 6
|
((ttl++))
|
||||||
|
if [[ $ttl -eq 1 ]]; then
|
||||||
|
sleep 15
|
||||||
|
elif [[ $new_updates -gt 1 ]]; then
|
||||||
|
sleep 6
|
||||||
|
else
|
||||||
|
sleep 3
|
||||||
|
fi
|
||||||
elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish
|
elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish
|
||||||
sleep 3
|
sleep 3
|
||||||
else # All processes must be completed, break out of loop
|
else # All processes must be completed, break out of loop
|
||||||
|
Loading…
Reference in New Issue
Block a user