[CentOS] use of MAILTO variable in crontab

m.roth at 5-cent.us m.roth at 5-cent.us
Wed Jul 13 19:26:02 UTC 2011


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?

30 2 * * * echo "this should be mailed" | mail -s "important email"
testaddr at harte-lyne.ca

will work.

         mark




More information about the CentOS mailing list