Skip to content

Instantly share code, notes, and snippets.

@bwkeller
Last active July 5, 2016 03:55
Show Gist options
  • Save bwkeller/233d3966825150dd3ade788989c5f953 to your computer and use it in GitHub Desktop.
Save bwkeller/233d3966825150dd3ade788989c5f953 to your computer and use it in GitHub Desktop.
Keep N processes going at once
#!/bin/bash
N=`ps ax | grep PROCESS | wc -l` #this will be 2+the number of PROCESSes running
while true
do
while [ "$N" -lt "THRESHOLD+2" ]
do
PROCESS &
done
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment