From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2010 Path: news.gmane.org!not-for-mail From: Janos Farkas Newsgroups: gmane.comp.sysutils.supervision.general Subject: pidsig 0.11 - a fghack like de-daemonisation tool Date: Wed, 2 Jun 2010 07:08:14 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1275458900 13584 80.91.229.12 (2 Jun 2010 06:08:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 2 Jun 2010 06:08:20 +0000 (UTC) To: supervision@list.skarnet.org Original-X-From: supervision-return-2245-gcsg-supervision=m.gmane.org@list.skarnet.org Wed Jun 02 08:08:19 2010 connect(): No such file or directory Return-path: Envelope-to: gcsg-supervision@lo.gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1OJh7i-0001P8-SJ for gcsg-supervision@lo.gmane.org; Wed, 02 Jun 2010 08:08:18 +0200 Original-Received: (qmail 14355 invoked by uid 76); 2 Jun 2010 06:10:21 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 14344 invoked from network); 2 Jun 2010 06:10:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=sxN0/IPFDstXy9IY2GH/E9RUIlfq01QHbEw1ZNhQHmc=; b=R/4sOO4Ik+Jmhcwb5Msi2N+7mhABGCSp1JqI4KHzz9h4sGlV6aYbPoaSY8av9+Fn3a Plc7AV0MFxmYyIl3k5vXg3E+qv+eIM3ePRMjl/0a6+DIhDOVzigdK2anzjUfa/LBYxx0 5sOE6ByIYSbotwK7Hfh+A8YL1uY8xsw4Q5W9o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=wdNLDS4BXv12XXAgtL8ovseNVHDN5h8sbUixmKmUUMBsNoPC7cynFFRoTfApJSK3wV QuLh8db4DE7Hx/V/q5zsyzIoEgI2CDOGqgTUJXd1Mndr2ogekOTvRTNdhnpOWWSqx/Qv TKUN63lMrTbrdi1fhDHBZkX5gxIkMtyF2hGQ4= Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2010 Archived-At: 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