Avoid false matches and detect multiple host processes

This commit is contained in:
Bob Lantz
2013-04-12 13:30:50 -07:00
parent 7bc10ebc7a
commit 6c22e057cc
+8 -2
View File
@@ -9,10 +9,16 @@ else
host=$1
fi
pid=`pgrep -f mininet:$host`
pid=`ps ax | grep mininet:$host | grep bash | awk '{print $1};'`
if echo $pid | grep -q ' '; then
echo "Error: found multiple mininet:$host processes"
exit 2
fi
if [ "$pid" == "" ]; then
echo "Could not find Mininet host $host"
exit 2
exit 3
fi
if [ -z $2 ]; then