Skip to content

Instantly share code, notes, and snippets.

@laztname
Created February 28, 2020 18:02
Show Gist options
  • Save laztname/083c326ca6403493ba95da6db750667d to your computer and use it in GitHub Desktop.
Save laztname/083c326ca6403493ba95da6db750667d to your computer and use it in GitHub Desktop.
parallel against time
function pwait() {
while [ $(jobs -p | wc -l) -ge $1 ]; do
sleep 1
done
}
for i in $(cat list.txt); do
do_the_jobs &
pwait 6 # 6 = max thread
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment