From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/596 Path: main.gmane.org!not-for-mail From: Charlie Brady Newsgroups: gmane.comp.sysutils.supervision.general Subject: supervising autofs (was Re: kdm not working in run script - SOLVED!!) Date: Sun, 3 Oct 2004 13:05:55 -0400 (EDT) Message-ID: References: <04149FEF-14E4-11D9-9AF0-000A9598BFB2@annvix.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1096823173 26461 80.91.229.6 (3 Oct 2004 17:06:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 3 Oct 2004 17:06:13 +0000 (UTC) Cc: John Nielsen , Original-X-From: supervision-return-835-gcsg-supervision=m.gmane.org@list.skarnet.org Sun Oct 03 19:05:59 2004 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14] ident=qmailr) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 1CE9o7-0002Mz-00 for ; Sun, 03 Oct 2004 19:05:59 +0200 Original-Received: (qmail 22571 invoked by uid 76); 3 Oct 2004 17:06:19 -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 22565 invoked from network); 3 Oct 2004 17:06:19 -0000 X-X-Sender: charlieb@e-smith.charlieb.ott.istop.com Original-To: Vincent Danen In-Reply-To: <04149FEF-14E4-11D9-9AF0-000A9598BFB2@annvix.org> Xref: main.gmane.org gmane.comp.sysutils.supervision.general:596 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:596 On Sat, 2 Oct 2004, Vincent Danen wrote: > Annvix uses runit... I'm not aware of any others that do, but Annvix > uses it completely out of the box. The only service that is not run > under runit is autofs, which I still have to figure out. I think this patch (untested) will give you the -f option you need: --- autofs-4.0.0pre10/daemon/automount.c.orig 2004-08-22 19:40:30.000000000 -0400 +++ autofs-4.0.0pre10/daemon/automount.c 2004-08-22 20:03:44.000000000 -0400 @@ -1143,7 +1143,7 @@ return -1; } -static void become_daemon(void) +static void become_daemon(int foreground) { FILE *pidfp; pid_t pid; @@ -1153,7 +1153,7 @@ chdir("/"); /* Detach from foreground process */ - if ( !submount ) { + if ( !submount && !foreground) { pid = fork(); if ( pid > 0 ) exit(0); @@ -1248,6 +1248,7 @@ const char **mapargv; struct sigaction sa; int mapargc, opt; + int foreground = 0; static const struct option long_options[] = { {"help", 0, 0, 'h'}, {"pid-file", 1, 0, 'p'}, @@ -1263,12 +1264,15 @@ ap.exp_timeout = DEFAULT_TIMEOUT; opterr = 0; - while ( (opt = getopt_long(argc, argv, "+hp:t:v", long_options, + while ( (opt = getopt_long(argc, argv, "+hp:t:v:f", long_options, NULL)) != EOF ) { switch( opt ) { case 'h': usage(); exit(0); + case 'f': + foreground++; + break; case 'p': pid_file = optarg; break; @@ -1299,7 +1303,7 @@ exit(1); } - become_daemon(); + become_daemon(foreground); path = argv[0]; map = argv[1];