supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* pidsig 0.11 - a fghack like de-daemonisation tool
@ 2010-06-02  6:08 Janos Farkas
  2010-06-02 18:46 ` Laurent Bercot
  0 siblings, 1 reply; 10+ messages in thread
From: Janos Farkas @ 2010-06-02  6:08 UTC (permalink / raw)
  To: supervision

Hi,

I've been using a tool to replace fghack in Bernstein chains.  It
overcomes at least one limitation of fghack, namely that fghack
doesn't have a way to pass on signals to daemons that it started.

pidsig works very similarly to fghack, will create (at least) one pipe
in the newly started daemon, but in addition to that, it will also
keep track of the pid for the child it started.  With the recorded
pid, pidsig is able to pass on (some) signals that it receives itself.

In absence (or in addition to) the child pid, it can send signals to
processes that have recorded pid files.

Although it's still best to modify daemons to not actually put
themselves to background, there are occasionally exceptions that are
difficult to handle otherwise.

One such example is nginx - which has an own "worker" scheme, and
supports online code replacement, thus, occasionally can have several
main threads, keeping several pid files for them when this is in
progress.

pidsig will be able to work with two kinds of daemons:
- those that don't go out their way to close all open fd's (just like fghack)
- those that don't go out their way to disconnect parent pids by
forking too many times

Furthermore:
- it can chroot (although if still running as root, it may not be much
more "secure")
- it can run as a specific user (but then it may be limited in what
processes it can kill)
- can read several(!) pid files to pass on signals to - to signify
quit, configuration reload, etc.

I've been using it successfully to manage a few nginx configurations
with daemontools, it also works well with the atd from the Linux at
package.

Sample usage for nginx:

pidsig -d/var/run -pnginx.pid.oldbin -pnginx.pid /usr/sbin/nginx

There are some obvious, and some quirky features that I have plans to
implement - it all depends on the interest.  Please drop me a note if
any of the above sounds interesting and/or check out its project page
at github:

  http://github.com/chexum/pidsig

Janos


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-06-04 20:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-02  6:08 pidsig 0.11 - a fghack like de-daemonisation tool Janos Farkas
2010-06-02 18:46 ` Laurent Bercot
2010-06-03 16:53   ` Janos Farkas
2010-06-03 19:25     ` Laurent Bercot
2010-06-04 16:26       ` Wayne Marshall
2010-06-04 16:54         ` Charlie Brady
2010-06-04 17:17           ` Wayne Marshall
2010-06-04 17:21             ` Charlie Brady
2010-06-04 20:00               ` Wayne Marshall
2010-06-04 18:43           ` Laurent Bercot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).