I would really like have option for start-stop-deamon to kill all childs of given process (at least direct ofsprings). There is problem with shell-scripts containing pipes/subshells, so they cannot be killed with start-stop-deamon (the main script is killed, the pipes/subshells live forever) Reproducible: Always Steps to Reproduce: 1. myscript.sh: tail -f /var/log/messages |grep "something" | ( while read line; do something_with $line done ) 2. start-stop-daemon --start -i -b -m -p /var/run/myscript.pid myscript.sh 3. start-stop-daemon --stop -i -p /var/run/myscript.pid myscript.sh 4. ps axf Actual Results: 19924 ? S 0:00 \_ tail -f /var/log/messages 19925 ? S 0:00 \_ grep something 19926 ? S 0:00 \_ /bin/bash myscript.sh Expected Results: the pipeline killed I think that there could be option like --with-childs, which would make start-stop-daemon kill not only given PID, but also its childs. It would allow use start-stop-deamon for scripts too. I would like make this change in my /etc/init.d scripts: - pkill -P `cat /var/run/myscript.pid` + start-stop-daemon --stop -i --with-childs -p /var/run/myscript.pid
It would help at the first glance only. The actual problem is the script/application itself. I expect that any daemon or application, that uses fork or threads, takes care of it's childs and thus kills them all on exit or even some error cases. I am not sure if we're going to add the requested feature.
I tend to agree with the previous comment. It is up to the application to make sure that all of its child processes die.
fwiw, this is what cgroup support would transparently enable