From: alexd on
I have a job in /etc/cron.d that I don't want to receive emails about.
If I make MAILTO= the first line in the job to disable email [as per man
5 crontab], it doesn't parse the crontab,

Error: bad minute; while reading /etc/cron.d/mysar

Is this a bug in Debian Testing's current cron, or have I misread the
man page?

--
<http://ale.cx/> (AIM:troffasky) (UnSoEsNpEaTm(a)ale.cx)
18:19:12 up 17 days, 17:58, 2 users, load average: 1.04, 2.00, 1.13
It is better to have been wasted and then sober
than to never have been wasted at all
From: Jim A on
On 05/15/2010 06:33 PM, alexd wrote:
> I have a job in /etc/cron.d that I don't want to receive emails about.
> If I make MAILTO= the first line in the job to disable email [as per man
> 5 crontab], it doesn't parse the crontab,
>
> Error: bad minute; while reading /etc/cron.d/mysar
>
> Is this a bug in Debian Testing's current cron, or have I misread the
> man page?
>

On Mandriva linux, the man page says:

If MAILTO is defined but empty (MAILTO=""), no
mail will be sent.

So I wonder if you're missing a couple of double-quotes?

Personally if I don't want mail for an individual crontab entry, I
redirect output to /dev/null so I haven't tried that method myself.

--
www.slowbicyclemovement.org - enjoy the ride
From: Chris on
On Sat, 15 May 2010 19:05:42 +0100, Jim A <ja(a)averyjim.myzen.co.uk> wrote:

> On 05/15/2010 06:33 PM, alexd wrote:
>> I have a job in /etc/cron.d that I don't want to receive emails about.
>> If I make MAILTO= the first line in the job to disable email [as per man
>> 5 crontab], it doesn't parse the crontab,
>>
>> Error: bad minute; while reading /etc/cron.d/mysar
>>
>> Is this a bug in Debian Testing's current cron, or have I misread the
>> man page?
>>
>
> On Mandriva linux, the man page says:
>
> If MAILTO is defined but empty (MAILTO=""), no
> mail will be sent.
>
> So I wonder if you're missing a couple of double-quotes?
>
> Personally if I don't want mail for an individual crontab entry, I
> redirect output to /dev/null so I haven't tried that method myself.

Same here. The added advantage of /dev/null is that it only affects one of
the cron jobs. The MAILTO= option would affect them all.
From: alexd on
On 15/05/10 20:40, Chris wrote:
> On Sat, 15 May 2010 19:05:42 +0100, Jim A <ja(a)averyjim.myzen.co.uk> wrote:

>> Personally if I don't want mail for an individual crontab entry, I
>> redirect output to /dev/null so I haven't tried that method myself.
>
> Same here. The added advantage of /dev/null is that it only affects one
> of the cron jobs. The MAILTO= option would affect them all.

Alas Debian's crontab now reports the exit status of the job if nonzero,
and it runs once a minute, so I'm getting hundreds of emails every day.

--
<http://ale.cx/> (AIM:troffasky) (UnSoEsNpEaTm(a)ale.cx)
21:20:18 up 17 days, 20:59, 2 users, load average: 4.78, 2.24, 1.34
It is better to have been wasted and then sober
than to never have been wasted at all
From: alexd on
On 15/05/10 19:05, Jim A wrote:

> On Mandriva linux, the man page says:
>
> If MAILTO is defined but empty (MAILTO=""), no
> mail will be sent.
>
> So I wonder if you're missing a couple of double-quotes?

If I do that, it doesn't choke on that when loading it, it waits until
it's running:

A message that you sent contained a recipient address that was incorrectly
constructed:

(null) empty address

The message has not been delivered to any recipients.

------ This is a copy of your message, including all the headers. ------


From: root (Cron Daemon)
To: (null)
Subject: Cron <root(a)westogre> /usr/local/bin/mysar >>
/usr/local/mysar/log/mysar-importer.log 2>&1 (failed)
Content-Type: text/plain; charset=ISO-8859-1
X-Cron-Env: <MAILTO=>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>

command failed with exit status 1

However, reading this:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=581612

and putting || [ $? -eq 1 ] on the end of the command does the trick.

--
<http://ale.cx/> (AIM:troffasky) (UnSoEsNpEaTm(a)ale.cx)
21:37:16 up 17 days, 21:16, 2 users, load average: 1.86, 1.03, 1.16
It is better to have been wasted and then sober
than to never have been wasted at all