On Wed, Feb 1, 2017 at 12:49 AM, Jonathan de Boyne Pollard
> You are talking to people well versed in the idea of chain-loading programs
> for affecting process state. The answer here is to simply run runsvdir
> through a chain-loading program that sets the process as a subreaper.
> You could write your own, or use the one that I wrote, packaged up, and
> published. I called it "local-reaper".
> * http://jdebp.eu./Softwares/nosh/guide/local-reaper.html
Very nice indeed. And as I see below you checked that it works with runsvdir.
It seems local-reaper is part of nosh, for which you provide a deb
package, but it is not included in Debian distribution. Is this
OK, so this could allow me to have a wrapper bash script which makes
sure processes inside Docker container are gracefully closed when
Docker container is stopped (see my other message to this mailing
list), and then I run runsvdir as PID 2 with local reaper chained
before it, so that any orphaned process is reaped by runsvdir. Because
it seems one cannot simply set:
trap "" SIGCHLD
in a PID 1 bash script. It seems it does not work. Because otherwise
one could just set SIGCHLD handler explicitly to SIG_IGN in PID 1 and
leave to the kernel to handle the orphaned processes.