mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 01:21:03 +01:00
24 lines
532 B
Python
24 lines
532 B
Python
|
|
import re
|
|
|
|
# various utilities that are handy
|
|
|
|
def execsys( args ):
|
|
import subprocess
|
|
if isinstance( args , str ):
|
|
r = re.compile( "\s+" )
|
|
args = r.split( args )
|
|
p = subprocess.Popen( args , stdout=subprocess.PIPE , stderr=subprocess.PIPE )
|
|
r = p.communicate()
|
|
return r;
|
|
|
|
def getprocesslist():
|
|
raw = ""
|
|
try:
|
|
raw = execsys( "/bin/ps -ax" )[0]
|
|
except Exception,e:
|
|
print( "can't get processlist: " + str( e ) )
|
|
|
|
r = re.compile( "[\r\n]+" )
|
|
return r.split( raw )
|