Skip to content

Instantly share code, notes, and snippets.

@petersg83
Created May 10, 2020 12:27
Show Gist options
  • Save petersg83/3ec36bf00580654e4a3a1bb6f03c0554 to your computer and use it in GitHub Desktop.
Save petersg83/3ec36bf00580654e4a3a1bb6f03c0554 to your computer and use it in GitHub Desktop.
for f in `ls *.py`
do
echo "---> $f"
python3 $f > /dev/null &
sleep 1
program=`ps -ef | grep "ython $f" | awk '{print $2}'`
pid=(${program})
pid=${pid[0]}
if (($pid > 0))
then
kill $pid > /dev/null 2>&1
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment