H!

I have made a program that is checking if a program is running or not.
If the program is not running then it must start the program again.

in the /etc/crontab:
*     *       *       *       *       root    /usr/sbin/
program_prgchk

in the /usr/sbin/program_prgchk:
/usr/local/bin/python /home/reseller/domeinaanvraag/program_prgchk.py


in the program_prgchk.py:
----------------------------------------
import string
import os
import commands

def checkifrunning():
    line = string.strip(commands.getoutput("ps x -o pid,command | grep
program_reseller.py | grep -v 'grep'"))
    pid = string.split(line,' ')[0]
    if pid<>'':pid = int(pid)
    return pid

if checkifrunning()=='':
    os.system('/usr/sbin/program_reseller')
#    os.wait()
#    os.waitpid(checkifrunning(),0)

os._exit(0)


If I run the command /usr/sbin/program_prgchk everything works (no
<defunct> process)
But when I use it in the crontab I get a <defunct> process

Thanks for helping,
GC-Martijn

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to