diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | fetchmail.c | 17 | ||||
-rw-r--r-- | fetchmail.h | 1 | ||||
-rw-r--r-- | fetchmail.man | 5 | ||||
-rw-r--r-- | options.c | 47 |
5 files changed, 52 insertions, 21 deletions
@@ -1,5 +1,8 @@ Release Notes: +pl 1.9.5 (): +* Added -N, --nodetach option for debugging purposes. + pl 1.9.4 (Mon Oct 28 20:58:48 EST 1994): * Correct status interpretation in closemailpipe() (thanks to Neil Harkins). * Tweak SMTP forwarding to only open one listener per SMTP host in daemon mode. diff --git a/fetchmail.c b/fetchmail.c index 5f76b8c2..7d9a71ca 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -50,6 +50,7 @@ int yydebug; /* enable parse debugging */ /* daemon mode control */ int poll_interval; /* poll interval in seconds */ +int nodetach; /* if TRUE, don't detach daemon process */ char *logfile; /* log file for daemon mode */ int quitmode; /* if --quit was set */ int check_only; /* if --probe was set */ @@ -434,7 +435,7 @@ char **argv; /* * Maybe time to go to demon mode... */ - if (poll_interval) + if (poll_interval && !nodetach) daemonize(logfile, termhook); /* beyond here we don't want more than one fetchmail running per user */ @@ -511,8 +512,22 @@ char **argv; endhostent(); /* release TCP/IP connection to nameserver */ #endif /* HAVE_GETHOSTBYNAME */ + if (outlevel == O_VERBOSE) + { + time_t now; + + time(&now); + fprintf(stderr, "fetchmail: sleeping at %s", ctime(&now)); + } if (sleep(poll_interval)) (void) fputs("fetchmail: awakened by SIGHUP\n", stderr); + if (outlevel == O_VERBOSE) + { + time_t now; + + time(&now); + fprintf(stderr, "fetchmail: awakened at %s", ctime(&now)); + } } while (poll_interval); diff --git a/fetchmail.h b/fetchmail.h index 4022f625..42d9ffc3 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -134,6 +134,7 @@ extern int yydebug; /* enable parse debugging */ /* daemon mode control */ extern int poll_interval; /* poll interval in seconds */ +extern int nodetach; /* if TRUE, don't detach daemon process */ extern char *logfile; /* log file for daemon mode */ extern int quitmode; /* if --quit was set */ extern int check_only; /* if --check was set */ diff --git a/fetchmail.man b/fetchmail.man index 38e848af..8f8d0389 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -310,6 +310,11 @@ option allows you to redirect status messages emitted while in daemon mode into a specified logfile (follow the option with the logfile name). The logfile is opened for append, so previous messages aren't deleted. This is primarily useful for debugging configurations. +.PP +The +.B \-N +or --nodetach option suppresses detachment of the daemon process +from its control terminal. This is primarily useful for debugging. .SH RETRIEVAL FAILURE MODES The protocols \fIfetchmail\fR uses to talk to mailservers are next to bulletproof. In normal operation forwarding to port 25, no message is @@ -21,27 +21,28 @@ #define LA_SILENT 4 #define LA_VERBOSE 5 #define LA_DAEMON 6 -#define LA_QUIT 7 -#define LA_LOGFILE 8 -#define LA_RCFILE 9 -#define LA_IDFILE 10 -#define LA_PROTOCOL 11 -#define LA_PORT 12 -#define LA_AUTHENTICATE 13 -#define LA_TIMEOUT 14 -#define LA_USERNAME 15 -#define LA_ALL 16 -#define LA_KILL 17 -#define LA_KEEP 18 -#define LA_FLUSH 19 -#define LA_NOREWRITE 20 -#define LA_LIMIT 21 -#define LA_REMOTEFILE 22 -#define LA_SMTPHOST 23 -#define LA_MDA 24 -#define LA_YYDEBUG 25 +#define LA_NODETACH 7 +#define LA_QUIT 8 +#define LA_LOGFILE 9 +#define LA_RCFILE 10 +#define LA_IDFILE 11 +#define LA_PROTOCOL 12 +#define LA_PORT 13 +#define LA_AUTHENTICATE 14 +#define LA_TIMEOUT 15 +#define LA_USERNAME 16 +#define LA_ALL 17 +#define LA_KILL 18 +#define LA_KEEP 19 +#define LA_FLUSH 20 +#define LA_NOREWRITE 21 +#define LA_LIMIT 22 +#define LA_REMOTEFILE 23 +#define LA_SMTPHOST 24 +#define LA_MDA 25 +#define LA_YYDEBUG 26 -static char *shortoptions = "?Vcsvd:qL:f:i:p:P:A:t:u:akKFnl:r:S:m:y"; +static char *shortoptions = "?Vcsvd:NqL:f:i:p:P:A:t:u:akKFnl:r:S:m:y"; static struct option longoptions[] = { {"help", no_argument, (int *) 0, LA_HELP }, {"version", no_argument, (int *) 0, LA_VERSION }, @@ -49,6 +50,7 @@ static struct option longoptions[] = { {"silent", no_argument, (int *) 0, LA_SILENT }, {"verbose", no_argument, (int *) 0, LA_VERBOSE }, {"daemon", required_argument, (int *) 0, LA_DAEMON }, + {"nodetach", no_argument, (int *) 0, LA_NODETACH }, {"quit", no_argument, (int *) 0, LA_QUIT }, {"logfile", required_argument, (int *) 0, LA_LOGFILE }, {"fetchmailrc",required_argument,(int *) 0, LA_RCFILE }, @@ -125,6 +127,10 @@ struct query *ctl; /* option record to be initialized */ case LA_DAEMON: poll_interval = atoi(optarg); break; + case 'N': + case LA_NODETACH: + nodetach = TRUE; + break; case 'q': case LA_QUIT: quitmode = TRUE; @@ -255,6 +261,7 @@ struct query *ctl; /* option record to be initialized */ fputs(" -s, --silent work silently\n", stderr); fputs(" -v, --verbose work noisily (diagnostic output)\n", stderr); fputs(" -d, --daemon run as a daemon once per n seconds\n", stderr); + fputs(" -N, --nodetach don't detach daemon process\n", stderr); fputs(" -q, --quit kill daemon process\n", stderr); fputs(" -L, --logfile specify logfile name\n", stderr); fputs(" -f, --fetchmailrc specify alternate run control file\n", stderr); |