Merge pull request #317 from cdburkard/patches/cleanup

added code to kill stale mininet processes
This commit is contained in:
lantz
2014-07-01 13:32:58 -07:00
+15 -1
View File
@@ -10,7 +10,7 @@ It may also get rid of 'false positives', but hopefully
nothing irreplaceable!
"""
from subprocess import Popen, PIPE
from subprocess import Popen, PIPE, check_output as co
import time
from mininet.log import info
@@ -69,4 +69,18 @@ def cleanup():
if link:
sh( "ip link del " + link )
info( "*** Killing stale mininet node processes\n" )
sh( 'pkill -9 -f mininet:' )
# Make sure they are gone
while True:
try:
pids = co( 'pgrep -f mininet:'.split() )
except:
pids = ''
if pids:
sh( 'pkill -f 9 mininet:' )
sleep( .5 )
else:
break
info( "*** Cleanup complete.\n" )