3 ms·
I swear this is one of the hardest problems in computer science, which is crazy - how hard should it really be to say "run this process, and restart it if it cr
by simonw 14y ago
I swear this is one of the hardest problems in computer science, which is crazy - how hard should it really be to say "run this process, and restart it if it crashes"?
- otterley 14y agoIt'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.