I have a shell script that spawns multiple processes, which run for an indefinite amount of time, however with the following OpenRC init script and the supervise-daemon daemon, upon stopping the service, only the shell script is killed and its child processes (mostly Python scripts) keep running.



depend() {
    use logger dns net
    after network sshd

Is there a way to kill the entire service process tree with supervise-daemon when killing the shell script without resorting to dirty workarounds like trapping the kill signal within the shell script and propagating it to children?

  • If the python script is the one creating child processes then it should be the place to handle them, IMO. You might try returning the process group from the script and use that to send the kill signal, or to query for all the child process ids. – Iain May 23 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.