How to start program that won't die when group is killed?

Grant Edwards grant.b.edwards at gmail.com
Tue Jun 26 22:46:24 UTC 2012


On 2012-06-26, Grant Edwards <grant.b.edwards at gmail.com> wrote:
> I'm trying to figure out how to start a program such that it won't die
> when the program's grandparent dies (I think the grandparent is the
> session leader).
>
> Here's the scenario:
>
>   1) lighttpd/PHP calls ash-prog-A.
>
>   2) ash-prog-A starts ash-prog-B (a long-running program that
>      needs to keep running when lighttpd gets stopped).       
>
> I've tried both "nohup &" and "start-stop-daemon -S", and neither
> work: ash-prog-B continues to run after ash-prog-A exits, but when
> lighttpd is stopped, ash-prog-B dies.

Looks like I spoke too soon.

Adding the '-b' option to start-stop-daemon seems to make it work.
According to what docs I can find, '-b' is the "background" option,
but that doesn't seem to be what it does.  AFAICT, the program is run
in the background either with or without the -b option, but with the
-b it's detached from the caller's group/session.

-- 
Grant Edwards               grant.b.edwards        Yow! My haircut is totally
                                  at               traditional!
                              gmail.com            



More information about the busybox mailing list