Kill child processes of an OpenRC service managed by supervise-daemon

by 493msi   Last Updated May 23, 2020 00:01 AM - source

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.

#!/sbin/openrc-run

supervisor=supervise-daemon
command="path/to/shell/script.sh"
command_args=""

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?



Related Questions



kill all processes of a user except a few in linux

Updated September 09, 2017 14:01 PM

kill -9 programs but they still hang on

Updated January 29, 2018 00:01 AM


Why can't I kill -9 this process?

Updated August 02, 2019 18:01 PM