Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 407865 - sys-apps/openrc - start-stop-deamon enhancement --with-childs
Summary: sys-apps/openrc - start-stop-deamon enhancement --with-childs
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: x86 Linux
: Normal enhancement
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-11 23:59 UTC by gilhad
Modified: 2012-04-30 01:21 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gilhad 2012-03-11 23:59:44 UTC
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
Comment 1 Christian Ruppert (idl0r) gentoo-dev 2012-04-26 13:38:40 UTC
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.
Comment 2 William Hubbs gentoo-dev 2012-04-26 15:37:50 UTC
I tend to agree with the previous comment. It is up to the application
to make sure that all of its child processes die.
Comment 3 SpanKY gentoo-dev 2012-04-30 01:21:13 UTC
fwiw, this is what cgroup support would transparently enable