Hate to reply to my own thread, but this is the working program that can demonstrate what I posted earlier:
import os from subprocess import Popen pids = {} counts = [0,0,0] for i in xrange(3): p = Popen('sleep 1', shell=True, cwd='/home', stdout=file(os.devnull,'w')) pids[p.pid] = i print "Starting child process %d (%d)" % (i,p.pid) while (True): (pid,exitstat) = os.wait() i = pids[pid] del pids[pid] counts[i]=counts[i]+1 #terminate if count>10 if (counts[i]==10): print "Child Process %d terminated." % i if reduce(lambda x,y: x and (y>=10), counts): break continue print "Child Process %d terminated, restarting" % i p = Popen('sleep 1', shell=True, cwd='/home', stdout=file(os.devnull,'w')) pids[p.pid] = i -- http://mail.python.org/mailman/listinfo/python-list