Created
March 8, 2019 08:51
-
-
Save wwwins/9434b751a205df290916c529fc233d90 to your computer and use it in GitHub Desktop.
A simple process pool in shell script
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
#!/bin/sh | |
FILENAME="XXX.py" | |
if [ -z $CORES ] | |
then | |
CORES=3 | |
fi | |
cnt=0 | |
while true; do | |
cnt=$(ps -aux | grep -v "grep" | grep -c "$FILENAME") | |
if [ $cnt -lt $CORES ] | |
then | |
break | |
fi | |
sleep 1 | |
done | |
python -W ignore XXX.py $1 $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment