[CentOS] centos 6.3, cron and mail script output

Les Mikesell lesmikesell at gmail.com
Wed Nov 28 19:11:22 UTC 2012


On Mon, Nov 26, 2012 at 12:32 AM, Mihamina Rakotomandimby
<mihamina at rktmb.org> wrote:
>
> I have "MAILTO=root" in the file.
> If I make a CLI test to mail to root, all is working.
>
> Is there a special feature such as "it only mail if STDERR"?
> Because all the messages (rsync output + echo "foo") is to STDOUT.
>
> I cant find any doc about that.
> I suspect the thing to mail only if it's an error message...

You can redirect stdout to /dev/null if you don't ever want it.  Then
cron will only send mail if something is written to stderr.  If you
want to collect stdout but discard it unless there is error output
you'll have to mange a tmp file yourself.

-- 
   Les Mikesell
     lesmikesell at gmail.com


More information about the CentOS mailing list