[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: getting emails from cron despite redirecting output to a log file



MKS,

Thank you ! That clears that up for me. I used tee because the crontab I was using as a model was generated by the default install on Debian. I checked the man page for tee because I had never seen it before, but it still didn't register in my mind what it was doing exactly. Thank you again for clearing that up for me, and thank you to others who took time to reply also.

Have a great day!
David


On Tue, Apr 1, 2014 at 5:12 AM, Markus Schönhaber <debian-user@list-post.mks-mail.de> wrote:
31.03.2014 20:22, David Nelson:

> I have configured mrtg to log network traffic for our organization. This is
> working nicely except at some point while I was fiddling with the scripts
> under /etc/cron.d, which run every 5 minutes to collect snmp data I started
> getting emails to root from cron. I have stared at this and googled a
> bit... yes even the man page, but I don't see what I have messed up here:
>
>  if [ -x /usr/bin/mrtg ] && [ -r /etc/mrtg/rm_127_switch-mrtg.cfg ] ; then
> env LANG=C /usr/bin/mrtg /etc/mrtg/rm_127_switch-mrtg.cfg 2>&1 | tee -a
> /var/log/mrtg/mrtg.log ; fi

You explicitly pipe mrt's output to tee, which writes it to the given
log-file *and* stdout, which, in turn, will be mailed to you by cron.
If you don't want mail from cron, make sure that there's nothing writen
to stdout. And if you don't want to have something written to stdout,
why do you use tee? Redirect the output directly to the log-file instead.

--
Regards
  mks


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: [🔎] 533A90FB.80500@list-post.mks-mail.de" target="_blank">https://lists.debian.org/[🔎] 533A90FB.80500@list-post.mks-mail.de



Reply to: