[CentOS] use of MAILTO variable in crontab
mburger at bubbanfriends.org
Thu Jul 14 17:28:26 UTC 2011
> On Wed, Jul 13, 2011 at 9:10 PM, James B. Byrne <byrnejb at harte-lyne.ca>
>> On Wed Jul 13 15:03:40 EDT 2011, Michael Best mbest at pendragon.org
>>> 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
> 30 2 * * * echo "this should be mailed to root"
> MAILTO="james at harte.x.x"
> 30 4 * * * echo "this should be mailed to James"
> 30 5 * * * echo "this should be mailed to Bob"
> 30 6 * * * echo "this should be mailed to no-one"
Why not simply do one of the following:
30 6 * * * /path/to/job 2>&1 | mail -s "<job name> output" user at domain
Within the script that runs the job, send the output of the to a file,
then cat the contents of the file through
mail -s "<job name> output" user at domain.com
Visit the Dog Pound II BBS
telnet://dogpound2.citadel.org or http://dogpound2.citadel.org
To be notified of updates to the web site, visit:
or send a blank email message to:
site-update-subscribe at bubbanfriends.org
More information about the CentOS