Kamuela Franco <ka******@verizon.net> wrote in message news:<pa****************************@verizon.net>. ..
I would like to use a Python script to periodically check to see if a
program is still running and if it isn't I want to start it up. Could
someone point me on the right path? Thanks in advance.
Kamuela
1st, which OS are we talking about ? *IF* we're talking about
Linux/Unix/FreeBSD, then it only takes a few lines:
import os
import string
f = os.popen( 'ps -ax' )
s = f.readlines()
if string.find( s, 'target_pgm' ) > -1:
#### we found it, so do something....
If we're talking about Windows, then this would work using the
Cygwin utils for ps or one could try Pythonwin. Mark has ported
many Windows APIs, so it would be a little more involved, but
straight-fwd. HTH....Jet