supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Gerrit Pape <pape@smarden.org>
Subject: Re: runsv and process groups
Date: Sat, 11 Sep 2004 09:58:33 +0000	[thread overview]
Message-ID: <20040911095830.2967.qmail@58667d9f8a4845.315fe32.mid.smarden.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0408262102290.3311-100000@e-smith.charlieb.ott.istop.com>

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

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.

[-- Attachment #2: diff1 --]
[-- Type: text/plain, Size: 1258 bytes --]

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);

      reply	other threads:[~2004-09-11  9:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-19 17:30 getty trouble Dan Melomedman
2004-08-20  7:19 ` Gerrit Pape
2004-08-20 16:45   ` Dan Melomedman
2004-08-23  0:04   ` runsv and process groups (was Re: getty trouble) Charlie Brady
2004-08-23 13:26     ` runsv and process groups Clemens Fischer
2004-08-23 21:29       ` Charlie Brady
2004-08-26 16:27         ` Clemens Fischer
2004-08-26 17:05           ` Charlie Brady
2004-08-26 20:48             ` Gerrit Pape
2004-08-26 20:57               ` Paul Jarc
2004-08-29  9:39                 ` Gerrit Pape
2004-08-27  1:06               ` Charlie Brady
2004-09-11  9:58                 ` Gerrit Pape [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040911095830.2967.qmail@58667d9f8a4845.315fe32.mid.smarden.org \
    --to=pape@smarden.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).