Controlling processes from Python
- by Nathan
Hi,
I want to control several subprocesses of the same type from python (I am under linux).
I want to:
Start them.
Stop them.
Ask if they are still running.
I can start a processes with with spawnl, and get the pid. Using this pid I can stop it with kill. And I am sure there is also a way to ask if it is running with the pid.
The problem is, what if the following happens:
I start a process, remember the pid. The process ends without me noticing and another completely different process starts getting assigned the same pid. I attempt to kill my process, I kill a completely different one.
What is the better way to start and control processes in python?
Thanks!