Created
February 24, 2017 07:21
-
-
Save ftorto/f090cf69f0cf21f5fb48adbfb812c816 to your computer and use it in GitHub Desktop.
Parallelize actions with max parallel count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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