Skip to content

Instantly share code, notes, and snippets.

@kcha
Last active August 29, 2015 14:18
Show Gist options
  • Save kcha/c2373cb971c8c6156f83 to your computer and use it in GitHub Desktop.
Save kcha/c2373cb971c8c6156f83 to your computer and use it in GitHub Desktop.
Chunk jobs so that they don't all execute at the same time
N=4 # Chunk size
C=0 # Counter
for i in {1..12};
do
# submitjob here...
echo $i
((C=C+1))
if [[ `expr $C % $N` == 0 ]]; then
sleep 1s
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment