This commit is contained in:
Heavybullets8 2022-07-27 15:07:53 -06:00
parent ef43d3c214
commit fd21a80db0

View File

@ -21,6 +21,7 @@ do
for proc in "${processes[@]}" for proc in "${processes[@]}"
do do
kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); }
((count++))
done done
if [[ "$proc_count" -ge "$update_limit" ]]; then if [[ "$proc_count" -ge "$update_limit" ]]; then
sleep 3 sleep 3
@ -28,9 +29,10 @@ do
update_apps "${array[$it]}" & update_apps "${array[$it]}" &
processes+=($!) processes+=($!)
((it++)) ((it++))
elif [[ ${#processes[@]} != 0 ]]; then # Wait for all processes to finish elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish
sleep 3 sleep 3
else else # All processes must be completed, break out of loop
wait "${processes[*]}"
break break
fi fi
done done