From 259e2ff74c50d240b99e46c3ec6326ca8f98a0a2 Mon Sep 17 00:00:00 2001
From: Matthias Andree
Date: Sat, 20 Jun 2009 09:57:41 +0000
Subject: Add documentation on how to make EXIT CODE 1 not an error.
Fixes Debian Bug#530749, filed by Reuben Thomas.
svn path=/branches/BRANCH_6-3/; revision=5361
---
NEWS | 6 +++++-
fetchmail-FAQ.html | 36 ++++++++++++++++++++++++++++++++++--
fetchmail.man | 16 ++++++++++++----
3 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/NEWS b/NEWS
index c9a6fc0b..a8f1629c 100644
--- a/NEWS
+++ b/NEWS
@@ -123,9 +123,13 @@ fetchmail 6.3.10 (not yet released):
* A document, README.SSL-SERVER, was added to describe server-side requirements
for proper SSL and/or TLS service offerings. These are not specific to
fetchmail.
+* Documentation on how to make "NOMAIL" (exit code 1) not treated an error has
+ been added to the EXIT CODES section of the manpage and to the FAQ as item C8.
+ The suggested solution uses a tiny POSIX shell script fragment.
+ Fixes Debian Bug #530749, filed by Reuben Thomas.
# TRANSLATION UPDATES AND ADDITIONS (ordered by language name):
-* [cs] Czech (Petr Pisar)
+* [cs] Czech (Petr Pisar)
* [en_GB] English/British
* [de] German
* [id] Indonesian (Andhika Padmawan)
diff --git a/fetchmail-FAQ.html b/fetchmail-FAQ.html
index a14b2d09..5abc4656 100644
--- a/fetchmail-FAQ.html
+++ b/fetchmail-FAQ.html
@@ -115,8 +115,9 @@ often than others?
C6. Fetchmail works OK started up manually, but not
from an init script.
C7. How can I forward mail to another
-host?.
-
+host?
+C8. Why is "NOMAIL" an error?/I frequently get messages
+from cron!
How to make fetchmail play nice with various MTAs
@@ -1290,6 +1291,37 @@ host?
fetchmail on, use the smtphost
or
smtpname
option. See the manual page for details.
+
+
+Some users want to write scripts that take action only if mail
+could/could not be retrieved, thus fetchmail reports if it has retrieved
+messages or not.
+
+If you do not want "no mail" to be an error condition (for instance,
+for cron jobs), use a POSIX-compliant shell and add this to the end of
+the fetchmail command line, it will change an exit code of 1 to 0 and
+others to 1:
+
+|| [ $? -eq 1 ]
+
+
+If you want to map more than one code to 0, you cannot cascade multiple
+|| [ $? -eq N ], but you must instead use the
+-o operator inside the brackets, (see the test(1)
+manpage for details), such as:
+
+
+|| [ $? -eq 1 -o $? -eq 9 ]
+
+
+A full cron line might then look like this:
+
+
+*/15 * * * * fetchmail -s || [ $? -eq 1 ]
+
+
+
How to make fetchmail play nice with various MTAs