From: Charlie Brady <charlieb-smarden-supervision@budge.apana.org.au>
Cc: John Nielsen <knoglen@tele2.fr>, <supervision@list.skarnet.org>
Subject: supervising autofs (was Re: kdm not working in run script - SOLVED!!)
Date: Sun, 3 Oct 2004 13:05:55 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.44.0410031304180.27752-100000@e-smith.charlieb.ott.istop.com> (raw)
In-Reply-To: <04149FEF-14E4-11D9-9AF0-000A9598BFB2@annvix.org>
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];
next prev parent reply other threads:[~2004-10-03 17:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-30 17:21 kdm not working in run script John Nielsen
2004-09-30 19:34 ` kdm not working in run script - SOLVED!! John Nielsen
2004-09-30 19:41 ` Paul Jarc
2004-10-01 19:24 ` John Nielsen
2004-10-01 19:27 ` John Nielsen
2004-10-01 19:31 ` Charlie Brady
2004-10-01 20:12 ` John Nielsen
2004-10-03 2:29 ` Vincent Danen
2004-10-03 17:05 ` Charlie Brady [this message]
2004-10-04 19:01 ` supervising autofs (was Re: kdm not working in run script - SOLVED!!) Vincent Danen
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=Pine.LNX.4.44.0410031304180.27752-100000@e-smith.charlieb.ott.istop.com \
--to=charlieb-smarden-supervision@budge.apana.org.au \
--cc=knoglen@tele2.fr \
--cc=supervision@list.skarnet.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).