Is there a way to check to see if a pid corresponds to a valid process? I'm getting a pid from a different source other than from os.getpid() and I need to check to see if a process with …
I have this:
def get_process():
pids = []
process = None
for i in os.listdir('/proc'):
if i.isdigit():
pids.append(i)
for pid in pids:
proc = open(os.path.join('/proc', pid, 'cmdline'), 'r').readline()
if proc == "Something":
…
I'm trying to port a shell script to the much more readable python version. The original shell script starts several processes (utilities, monitors, etc.) in the background with "&". How can I achieve the same effect in python? I'd like …