IT源码网

ps -ef

shasha 2019年12月13日 程序员 681 0

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代表匹配到了

评论关闭
IT源码网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!