From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/578 Path: main.gmane.org!not-for-mail From: Gerrit Pape Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: runsv and process groups Date: Sat, 11 Sep 2004 09:58:33 +0000 Message-ID: <20040911095830.2967.qmail@58667d9f8a4845.315fe32.mid.smarden.org> References: <20040826204817.1893.qmail@a4750aef5ce996.315fe32.mid.smarden.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="mvpLiMfbWzRoNl4x" X-Trace: sea.gmane.org 1094896693 1940 80.91.224.253 (11 Sep 2004 09:58:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 11 Sep 2004 09:58:13 +0000 (UTC) Original-X-From: supervision-return-816-gcsg-supervision=m.gmane.org@list.skarnet.org Sat Sep 11 11:58:09 2004 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14]) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 1C64e0-0001oW-00 for ; Sat, 11 Sep 2004 11:58:08 +0200 Original-Received: (qmail 25739 invoked by uid 76); 11 Sep 2004 09:58:30 -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 25734 invoked from network); 11 Sep 2004 09:58:30 -0000 Original-To: supervision@list.skarnet.org Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline In-Reply-To: Xref: main.gmane.org gmane.comp.sysutils.supervision.general:578 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:578 --mvpLiMfbWzRoNl4x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Aug 26, 2004 at 09:06:54PM -0400, Charlie Brady wrote: > On Thu, 26 Aug 2004, Gerrit Pape wrote: > > Hm, I'm not sure yet. What do you think about runsvdir running runsv in > > a new process group, and not runsv the run script? > > That'd satisfy my concern, which is that a buggy run script or daemon can > easily take down the whole system. That's certainly not the resiliency > which people are looking for when they use supervise/runit. Or at least, > which I'm looking for. > > I have more than an academic interest in this issue, since I've been > bitten by it in the past. Here's a patch to runsvdir that adds a -P option to run each runsv process in a new session and process group. You need to change /etc/runit/2 or /sbin/runsvdir-start to enable it. Regards, Gerrit. --mvpLiMfbWzRoNl4x Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff1 Index: src/runsvdir.c =================================================================== RCS file: /var/lib/cvs/runit/src/runsvdir.c,v retrieving revision 1.15 diff -u -r1.15 runsvdir.c --- src/runsvdir.c 2 Aug 2004 14:02:46 -0000 1.15 +++ src/runsvdir.c 11 Sep 2004 09:26:26 -0000 @@ -16,7 +16,7 @@ #include "sig.h" #include "ndelay.h" -#define USAGE " dir" +#define USAGE " [-P] dir" #define VERSION "$Id: runsvdir.c,v 1.15 2004/08/02 14:03:08 pape Exp $" #define MAXSERVICES 1000 @@ -39,6 +39,7 @@ iopause_fd io[1]; struct taia stamplog; int exitsoon =0; +int pgrp =0; void usage () { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); } void fatal(char *m1, char *m2) { @@ -72,6 +73,7 @@ warn("unable to set filedescriptor for log service", 0); sig_uncatch(sig_hangup); sig_uncatch(sig_term); + if (pgrp) setsid(); pathexec_run(*prog, prog, (const char* const*)environ); fatal("unable to start runsv ", name); } @@ -174,6 +176,13 @@ progname =*argv++; if (! argv || ! *argv) usage(); + if (**argv == '-') { + switch (*(*argv +1)) { + case 'P': pgrp =1; + case '-': ++argv; + } + if (! argv || ! *argv) usage(); + } sig_catch(sig_term, s_term); sig_catch(sig_hangup, s_hangup); --mvpLiMfbWzRoNl4x--