From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2137 Path: news.gmane.org!not-for-mail From: Charlie Brady Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: What is the process group hack Date: Thu, 26 Apr 2012 15:02:26 -0400 (EDT) Message-ID: References: <20120426202753.1cc24411@b0llix.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: dough.gmane.org 1335466952 10175 80.91.229.3 (26 Apr 2012 19:02:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 26 Apr 2012 19:02:32 +0000 (UTC) Cc: harish badrinath , supervision@list.skarnet.org To: Wayne Marshall Original-X-From: supervision-return-2371-gcsg-supervision=m.gmane.org@list.skarnet.org Thu Apr 26 21:02:31 2012 Return-path: Envelope-to: gcsg-supervision@plane.gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1SNTxW-0002HH-PF for gcsg-supervision@plane.gmane.org; Thu, 26 Apr 2012 21:02:30 +0200 Original-Received: (qmail 2864 invoked by uid 76); 26 Apr 2012 19:06:16 -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 2854 invoked from network); 26 Apr 2012 19:06:16 -0000 X-X-Sender: charlieb@e-smith.charlieb.ott.istop.com In-Reply-To: <20120426202753.1cc24411@b0llix.net> Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2137 Archived-At: On Thu, 26 Apr 2012, Wayne Marshall wrote: > fghack is djb's "anti-backgrounding" utility. It invokes > strangeness and mysteries to inhibit a process from forking into > the background. No, it doesn't change anything about the way the process operates. It just starts the process in a child process, and attempts to stay around until that process exits. See the description here: http://cr.yp.to/daemontools/faq/create.html fghack creates a pipe from the daemon and reads data until the pipe is closed. Normally all the daemon's descendants will inherit the open pipe from the daemon, so the pipe will not be closed until they all exit. However, fghack will exit early if the daemon goes out of its way to close extra descriptors. A few of these daemons leave descriptor 0 open, even though they do not use descriptor 0; so #!/bin/sh exec fghack baddaemon <&- might work.