LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-10-2011, 10:08 AM   #1
invader7
LQ Newbie
 
Registered: Jun 2011
Posts: 24

Rep: Reputation: Disabled
How to stop cronjobs from sending emails....


Hello i was receiving emails for all my cronjobs , then i added MAILTO="" at cronjob list with crontab -e , now i receive only 1 email ....

Subject: Cron <www-data@b0x> [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh
From: root <root>
To: www-data <www-data>

how can i stop these emails ??
 
Old 10-10-2011, 10:31 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Make output go to the bit bucket using '/usr/share/awstats/tools/update.sh > /dev/null 2>&1' but note you then won't be alerted on errors either.
 
1 members found this post helpful.
Old 10-10-2011, 11:15 AM   #3
invader7
LQ Newbie
 
Registered: Jun 2011
Posts: 24

Original Poster
Rep: Reputation: Disabled
before i add MAILTO="" i tried to put this at every line > /dev/null (only this) but it didn't work... my problem is that i can't find the line that sends email at the crontab.... very strange...it must be inside some other script
 
Old 10-10-2011, 11:39 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Usually a cronjob with a recognizable name like "awstats" somewhere in /etc like /etc/cron.d/awstats?..
 
Old 10-10-2011, 12:02 PM   #5
invader7
LQ Newbie
 
Registered: Jun 2011
Posts: 24

Original Poster
Rep: Reputation: Disabled
thanks mod , if i access /etc/cron.d/awstats with nano i can see these 2 lines.... so i have to edit the file and add the > /dev/null ?

*/10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh

# Generate static reports:
10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh
 
Old 10-10-2011, 12:23 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by invader7 View Post
thanks mod , if i access /etc/cron.d/awstats with nano i can see these 2 lines.... so i have to edit the file and add the > /dev/null ?
No, I said > /dev/null 2>&1 so it should look like
Code:
*/10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh > /dev/null 2>&1
(and don't call me "mod", that's not my handle)
 
Old 10-11-2011, 04:38 AM   #7
invader7
LQ Newbie
 
Registered: Jun 2011
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by unSpawn View Post
No, I said > /dev/null 2>&1 so it should look like
Code:
*/10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh > /dev/null 2>&1
(and don't call me "mod", that's not my handle)
yes thats what i mean , at the end of each live... i made it and it worked thanks
 
  


Reply



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
How do I stop daily updatedb cronJobs...? Alexvader Arch 3 08-18-2010 08:51 AM
Stop/Start all cronjobs single command cooljai Linux - General 1 02-05-2009 09:16 AM
Stop cronjobs overlapping ? MikeAtVillage Linux - General 6 05-23-2008 01:08 AM
cronjobs stop working after expiration of root password nichu Linux - General 1 09-28-2007 03:30 AM
is there a way to stop cronjobs mail for certain acticities manojthakkar Linux - General 5 12-08-2003 10:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:13 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration