3 ms·
It's not a hard problem at all; it's a rather simple loop: while true: pid = fork() if pid: # parent wait(pid) else: # child ex
by otterley 14y ago
It's not a hard problem at all; it's a rather simple loop:
while true:
pid = fork()
if pid: # parent
wait(pid)
else: # child
exec("/path/to/supervised/process")
The key here is not to let the supervised process daemonize itself. If it does, the parent can no longer wait() on the child.