ps -ef

status, msg = commands.getstatusoutput("ps -ef | grep start.sh | grep -Fv grep | awk '{print $10}'")

查找含有start.sh的进程,并过滤掉grep命令的行,然后输出第10列数据

status:执行状态,0代表没找到

msg:命令的执行结果,msg.find("start.sh")  -1代表没匹配到,>-1代表匹配到了

猜你喜欢

转载自www.cnblogs.com/lmh001/p/10292130.html