Article 5125W how to control how many times loop will reply ?

how to control how many times loop will reply ?

by
uyjjhak
from LinuxQuestions.org on (#5125W)
Long time ago I have used in my script:

Code:for i in `ls /directory`
do command &
doneAnd that working, but as the files qty increased I am getting OOM errors as that command starts all occurencies in one time.

I would like to find any way to limit number of parallel loop runs:

Like run the loop 5 times, when one of the occurencies will finish, andd another one, and after that add next one, or two, or any number to keep 5 concurrent


Is that possible ? That is the script which I am using to make lot of connections to remote storage - overnight I would utilise 100% of tunnel bandwith and the 'command' doesn't support multithreading :(.

Yeah, I see parallel package, but I can't change this scripts :(

regardslatest?d=yIl2AUoC8zA latest?i=FvbZj_Le8pw:wKIqYorj3xw:F7zBnMy latest?i=FvbZj_Le8pw:wKIqYorj3xw:V_sGLiP latest?d=qj6IDK7rITs latest?i=FvbZj_Le8pw:wKIqYorj3xw:gIN9vFwFvbZj_Le8pw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments