LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Limiting cron mail (http://www.linuxquestions.org/questions/linux-software-2/limiting-cron-mail-696687/)

i_nomad 01-12-2009 05:11 AM

Limiting cron mail
 
Hi
I have a cronjob run by root. This is sending a mail to root which points to x@y.com
The cronjob also sends confirmation of the job to x@y.com which I want.

Is there a way I can prevent the default cron mail send and just keep below. I dont want to prevent cron mail being received.

0 11 * * * /root/xx.sh | mail -s "`hostname` backup run" x@y.com

Can someone assist please.

Regards

billymayday 01-12-2009 05:34 AM

Does

Code:

0 11 * * * /root/xx.sh | mail -s "`hostname` backup run" x@y.com > /dev/null 2>&1
do the trick?

i_nomad 01-12-2009 05:42 AM

Hi

I did try that earlier, > /dev/null 2>&1 and that does not do the job. I still receive 2 emails x@y.com and from root that also points to x@y.com

The root cron mail has in subject:
Cron <root@xxx> /root/x.sh | mail -s "`hostname` Backup" x@y.com

and in the body:
Null message body; hope that's ok

I dont want this...


Regards

billymayday 01-12-2009 06:00 AM

You could try

MAILTO=""

at the top of your crontab

i_nomad 01-12-2009 06:15 AM

Cheers mate that has done the trick 8-)


All times are GMT -5. The time now is 03:06 PM.