I have some processes that I need to keep running on a linux host. For some reason the processes are dying (possibly being killed by another admin). I can hunt that down later, right now I need to make sure the processes are running and relaunch them if necessary
Launching the processes is no problem
import subprocess
proc1 = subprocess.Popen('first command')
proc2 = subprocess.Popen('second command')
But how do I monitor the processes and make sure that they are still running? I tried proc1.poll() but it always returns zero whether the program is running or not. I figure I would just set up a while loop that would go through each process once I know what to do with them.
Any ideas?