vi a1.py
#!/usr/bin/python
import os
http = os.popen(‘netstat -ntpl | grep -w 80‘,‘r‘).readlines()
str1 = ‘‘.join(http)
pid = str1.split()[6].strip(‘/apache2‘)
print pid
:wq
python a1.py
抓取apache2的进程pid
原文地址:http://blog.51cto.com/yangzhiming/2125026
#!/usr/bin/python
import os
http = os.popen(‘netstat -ntpl | grep -w 80‘,‘r‘).readlines()
str1 = ‘‘.join(http)
pid = str1.split()[6].strip(‘/apache2‘)
print pid
:wq
抓取apache2的进程pid
原文地址:http://blog.51cto.com/yangzhiming/2125026