[CentOS] use of MAILTO variable in crontab

Thu Jul 14 16:53:02 UTC 2011
Michael Best <mbest at pendragon.org>

On 07/13/2011 01:10 PM, James B. Byrne wrote:
>
> On Wed Jul 13 15:03:40 EDT 2011, Michael Best mbest at pendragon.org
>   wrote:
>> Like this:
>>
>> MAILTO=testaddr at harte-lyne.ca
>> 30 2 * * * echo "this should be mailed"
>
> That sets MAILTO for the entire crontab does it not?  I want to set
> MAILTO differently for specific crontab entries.  Is that possible?
> How is it done?  Or do I have to pipe stuff to /usr/bin/mail
> explicitly?

It sets the MAILTO for all entries that follow that MAILTO.  You can 
have multiple MAILTO entries in your crontab, as well as other variables.

If you only have one or two entries that need non-default mail handling, 
you can put them at the end of the crontab.

-Mike