http://marc.info/?l=openbsd-misc&m=142031621606691&w=2


----- Forwarded message from Jan Stary <[email protected]> -----

Date: Sat, 3 Jan 2015 21:15:58 +0100
From: Jan Stary <[email protected]>
To: [email protected]
Subject: Re: Failed cron jobs are silent


On Jan 03 19:05:11, [email protected] wrote:
> set the MAILTO variable in crontab.
> man 5 crontab not man 1 crontab

          MAILTO
          If MAILTO is defined and non-empty, mail is
          sent to the user so named.  If MAILTO is defined but empty
          (MAILTO = ""), no mail will be sent. Otherwise mail is
          sent to the owner of the crontab. This is useful for
          pseudo-users that lack an alias that would otherwise
          redirect the mail to a real person.

There seems to be a slight discrepancy between
what cron.1 says and what crontab.5 says.

I just put

        * * * * *       true
        * * * * *       false
        * * * * *       echo -n
        * * * * *       echo

into my crontab (current/amd64). Echo sends an email,
because it has an output (even if just the newline).
The mail goes either to me, or whatever I set MAILTO to be.
None of the others send any mail, regardless of MAILTO,
because there is no output from the command.

So it seems crontab.5 is slightly inacurate.

        Jan


Index: crontab.5
===================================================================
RCS file: /cvs/src/usr.sbin/cron/crontab.5,v
retrieving revision 1.33
diff -u -p -r1.33 crontab.5
--- crontab.5   30 Jan 2014 20:02:42 -0000      1.33
+++ crontab.5   3 Jan 2015 20:12:08 -0000
@@ -255,14 +255,16 @@ May not be overridden by settings in the
 If
 .Ev MAILTO
 is defined and non-empty,
-mail is sent to the user so named.
+mail is sent to the user so named
+if the command produces any output.
 If
 .Ev MAILTO
 is defined but empty
 .Pq Ev MAILTO = Qq ,
 no mail will be sent.
 Otherwise mail is sent to the owner of the
-.Nm .
+.Nm
+if the command produces any output.
 This is useful for pseudo-users that lack an alias
 that would otherwise redirect the mail to a real person.
 .It Ev SHELL


----- End forwarded message -----

Reply via email to