LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-12-2009, 05:11 AM   #1
i_nomad
Member
 
Registered: Mar 2008
Distribution: RedHatES4
Posts: 144

Rep: Reputation: 15
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

Last edited by i_nomad; 01-12-2009 at 05:13 AM.
 
Old 01-12-2009, 05:34 AM   #2
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Does

Code:
0 11 * * * /root/xx.sh | mail -s "`hostname` backup run" x@y.com > /dev/null 2>&1
do the trick?
 
Old 01-12-2009, 05:42 AM   #3
i_nomad
Member
 
Registered: Mar 2008
Distribution: RedHatES4
Posts: 144

Original Poster
Rep: Reputation: 15
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

Last edited by i_nomad; 01-12-2009 at 05:44 AM.
 
Old 01-12-2009, 06:00 AM   #4
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
You could try

MAILTO=""

at the top of your crontab
 
Old 01-12-2009, 06:15 AM   #5
i_nomad
Member
 
Registered: Mar 2008
Distribution: RedHatES4
Posts: 144

Original Poster
Rep: Reputation: 15
Cheers mate that has done the trick 8-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron mail sending using outside SMTP mail server Utah Linux - Software 6 08-24-2005 07:44 PM
No More Cron Mail, Cron Error? Xhost Linux - General 3 07-26-2004 04:28 PM
need only cron job mail on my mail id manojthakkar Linux - Newbie 0 12-20-2003 05:41 AM
cron mail help joesbox Linux - General 1 03-30-2003 10:20 PM
Cron: E-Mail me only when necessary elconde Linux - General 3 05-31-2002 09:40 AM


All times are GMT -5. The time now is 04:57 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration