4 ms·
Yes. If you kill foreman with Ctrl-C (or killing its pid externally) it will send SIGTERM to all of the child processes, followed 3 seconds later by SIGKILL to
by ddollar 15y ago
Yes. If you kill foreman with Ctrl-C (or killing its pid externally) it will send SIGTERM to all of the child processes, followed 3 seconds later by SIGKILL to any that haven't terminated yet.
- cturner 15y agoOK. But if those processes have spawned further children, then I expect they'll get isolated and keep running, now with PPID 0 (on linux, anyway). I have need for a tool that has the ability to kill not just one level of child processes, but the tree. I've built something similar to foreman recently and came up with a hacky way to do this tree kill. Every now and then my tool runs ps and parses the output. It uses PID and PPID to build a hierarchy of processes that are descended from it. I have a signal handler in the foreman-like tool that does the SIGTERM then SIGKILL like you describe. It's ugly and not portable but it is working in my setting. Since then I've heard about process groups and have been meaning to try that as an alternate mechanism. Something foreman has that my python tool doesn't have and that I want is the ability to bounce processes within the tree. I'd like to be able to throw away my code and replace it with something polished. Interested in any further thoughts you have. Update: hey - you're the author! Thanks. Another feature I'd like is the ability to query the foreman process running in the background and have it tell me what stuff it's currently running. The approach I've used in my tool was to use python-twisted to host a command line, and then I'd telnet to that and poke it. But - as I say above - it's still missing key features.