aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--fetchmail.c14
-rw-r--r--fetchmail.man27
3 files changed, 33 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index c1552417..bf3ded42 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,10 @@ would just be all-around pleasing aesthetically.
fetchmail-4.3.4 (Sat Nov 22 01:51:41 EST 1997)
* Yet another attempt on the Compuserve RPA moving target.
* Fix ETRN code to poll for the fetchmail host if there's no -S option.
+* Allow `--quit' to be given with other options to shut down a running daemon
+ before anything else gets done (suggested by Greg Stark).
+
+There are 277 people on fetchmail-friends and 92 on fetchmail-announce.
fetchmail-4.3.3 (Sat Nov 22 01:51:41 EST 1997)
* Robert Hardy <rhardy@webcon.net>'s patch to use IMAP EXAMINE in check mode.
diff --git a/fetchmail.c b/fetchmail.c
index 444814df..9daeacac 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -142,7 +142,7 @@ int main (int argc, char **argv)
}
/* avoid parsing the config file if all we're doing is killing a daemon */
- if (!quitmode)
+ if (!quitmode && argc == 2)
implicitmode = load_params(argc, argv, optind);
/* set up to do lock protocol */
@@ -205,7 +205,7 @@ int main (int argc, char **argv)
}
/* if no mail servers listed and nothing in background, we're done */
- if (!quitmode && pid == -1 && querylist == NULL) {
+ if (!(quitmode && argc == 2) && pid == -1 && querylist == NULL) {
(void)fputs("fetchmail: no mailservers have been specified.\n",stderr);
exit(PS_SYNTAX);
}
@@ -216,11 +216,12 @@ int main (int argc, char **argv)
if (pid == -1)
{
fprintf(stderr,"fetchmail: no other fetchmail is running\n");
- exit(PS_EXCLUDE);
+ if (argc == 2)
+ exit(PS_EXCLUDE);
}
else if (kill(pid, SIGTERM) < 0)
{
- fprintf(stderr,"fetchmail: error killing %s fetchmail at %d.\n",
+ fprintf(stderr,"fetchmail: error killing %s fetchmail at %d; bailing out.\n",
bkgd ? "background" : "foreground", pid);
exit(PS_EXCLUDE);
}
@@ -229,7 +230,10 @@ int main (int argc, char **argv)
fprintf(stderr,"fetchmail: %s fetchmail at %d killed.\n",
bkgd ? "background" : "foreground", pid);
unlink(lockfile);
- exit(0);
+ if (argc == 2)
+ exit(0);
+ else
+ pid = -1;
}
}
diff --git a/fetchmail.man b/fetchmail.man
index faceea15..48bbdf30 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -528,24 +528,37 @@ option --daemon 0 or -d0.
.PP
Only one daemon process is permitted per user; in daemon mode,
.I fetchmail
-makes a per-user lockfile to guarantee this. The option
+makes a per-user lockfile to guarantee this.
+.PP
+Normally, calling fetchmail with a daemon in the background sends a
+wakeup signal to the daemon, forcing it to poll mailservers
+immediately. (The wakeup signal is SIGHUP if fetchmail is running as
+root, SIGUSR1 otherwise.)
+.PP
+The option
.B --quit
-will kill a running daemon process. Otherwise, calling fetchmail with
-a daemon in the background sends a wakeup signal to the daemon,
-forcing it to poll mailservers immediately. (The wakeup signal is
-SIGHUP if fetchmail is running as root, SIGUSR1 otherwise.)
+will kill a running daemon process instead of waking it up (if there
+is no such option,
+.I fetchmail
+notifies you). If the --quit option is the only command-line option,
+that's all there is to it.
+.PP
+The quit option may also be mixed with other command-line options; its
+effect is to kill any running daemon before doing what the other
+options specify in combination with the rc file.
.PP
The
.B -t
or
.B --timeout
-option (keyword: timeout)allows you to set a server-nonresponse
+option (keyword: timeout) allows you to set a server-nonresponse
timeout in seconds. If a mailserver does not send a greeting message
or respond to commands for the given number of seconds,
\fIfetchmail\fR will hang up on it. Without such a timeout
\fIfetchmail\fR might hang up indefinitely trying to fetch mail from a
down host. This would be particularly annoying for a \fIfetchmail\fR
-running in background.
+running in background. There is a default timeout which fetchmail -V
+will report.
.PP
The
.B -L