pretty

Monday, November 5, 2012

Kill process with python on linux



import os
import signal

def kill_process(processname):
for line in os.popen("ps xa"):
fields = line.split()
pid = fields[0]
process = fields[4]
print process
if process == processname:
os.kill(int(pid), signal.SIGKILL)
break
else:
pass
look here for a windows solution or google it

No comments:

Post a Comment