severity #369666 wishlist
retitle #369666 Fail more gracefully when mailx is not available.
tags #369666 patch
thanks

On Fri, Jun 02, 2006 at 07:10:23AM +0200, Ola Lundqvist wrote:
> reopen 369666
> severity wishlist
> retitle Fail more gracefully when mailx is not available.

Fixing syntax errors.

> Well that can be argued as it is the meaning with recommends, but
> I can reopen it as a wishlist bug.

Attached patch will issue a warning if mail binary is not found.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835
--- cron-apt.orig       2007-07-28 09:08:16.000000000 +0200
+++ cron-apt    2007-07-28 09:12:10.000000000 +0200
@@ -273,15 +273,19 @@
        rm -f "$RUNMAIL"
     fi
     if [ -f "$MAIL" ] ; then
-        if [ -z "$HOSTNAME" ]; then
-            HOSTNAME="$(uname -n)"
-       fi
-       SUBJECT="CRON-APT completed on $HOSTNAME [$CONFIG]"
-       if [ -f "$ERROR" ] ; then
-           SUBJECT="CRON-APT error on $HOSTNAME [$CONFIG]"
+       if command -v mail >/dev/null; then
+            if [ -z "$HOSTNAME" ]; then
+                HOSTNAME="$(uname -n)"
+           fi
+           SUBJECT="CRON-APT completed on $HOSTNAME [$CONFIG]"
+           if [ -f "$ERROR" ] ; then
+               SUBJECT="CRON-APT error on $HOSTNAME [$CONFIG]"
+           fi
+           mail -s "$SUBJECT" "$MAILTO" < "$MAIL"
+           rm -f "$MAIL"
+       else
+           echo >&2 "cron-apt was configured to send e-mail, but no mail 
binary found in path."
        fi
-       mail -s "$SUBJECT" "$MAILTO" < "$MAIL"
-       rm -f "$MAIL"
     fi
     if [ -f "$DIFF" ] ; then
        rm -f "$DIFF"

Reply via email to