Skip to content

Instantly share code, notes, and snippets.

@ftorto
Created February 24, 2017 07:21
Show Gist options
  • Save ftorto/f090cf69f0cf21f5fb48adbfb812c816 to your computer and use it in GitHub Desktop.
Save ftorto/f090cf69f0cf21f5fb48adbfb812c816 to your computer and use it in GitHub Desktop.
Parallelize actions with max parallel count
function parallel_function {
# something
}
max_parallel_jobs=4
while true
do
parallel_function &
((start_date=start_date+1))
while [ $(jobs | wc -l) -ge $max_parallel_jobs ] ; do sleep 1 ; done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment