bruceg/daemontools-encore — pull request #3 by acg (2012-01-08 23:49:28+00:00)
Title: optionally setsid and transparently use process group control

These changes make managing multiprocess services easier and safer. An example of such a service is one with a long-running shell pipeline in its ./run file. Such services were problematic for classic daemontools and are still somewhat problematic for daemontools-encore.

* Only call setsid(2) if the s/setsid file exists, to preserve the classic daemontools behavior.

* If s/setsid exists, make sending of signals to the service's process group the default. Callers of svc(8) don't have to change their invocation to control a service that elects to use a process group.

* To explicitly send signals only to the process group leader of a multiprocess service, add the '=' option to svc(8). This is similar to the '+' option, which explicitly sends to the service's process group.

* When supervise(8) receives SIGTERM or SIGINT, propagate this to the supervised process by behaving as if svc -dx had been called. Otherwise a supervised process running in a separate process group will be orphaned. The common problematic scenario is sending ^C to svscan(8) running in the terminal foreground.