Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def process_exists(self, procname):
- ps = subprocess.Popen("ps -A", shell=True, stdout=subprocess.PIPE)
- ps_pid = ps.pid
- output = ps.stdout.read()
- ps.stdout.close()
- ps.wait()
- for line in output.split('\n'):
- if line != "" and line != None:
- fields = line.split()
- pid = fields[0]
- pname = fields[3]
- if (pname == procname):
- return True
- else:
- return True
- return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement