I copied from other place and it's a very useful tool. ================================================= #!/usr/bin/env python import os import sys import re if len(sys.argv) != 2: #print >> sys.stderr, "Provide one (and one only) pattern to match." sys.exit(1) ps = os.popen('ps -e') ps.readline() #-- To eliminate initial line for line in ps: try: match = re.search(r"%s" % ...
by gtaww - Solaris - 2006-08-31 12:05:34 阅读(1116) 回复(1)
如题,管道:/sbin/pidof xxx | sar 2 5 -x >> result 为啥不对呢? 目的是想根据名字的到一个进程ID然后监视这个进程并写如文件。 请高人帮忙看一下。谢谢了。