LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to stop cronjobs from sending emails.... (https://www.linuxquestions.org/questions/linux-server-73/how-to-stop-cronjobs-from-sending-emails-907394/)

invader7 10-10-2011 10:08 AM

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 ??

unSpawn 10-10-2011 10:31 AM

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.

invader7 10-10-2011 11:15 AM

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

unSpawn 10-10-2011 11:39 AM

Usually a cronjob with a recognizable name like "awstats" somewhere in /etc like /etc/cron.d/awstats?..

invader7 10-10-2011 12:02 PM

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

unSpawn 10-10-2011 12:23 PM

Quote:

Originally Posted by invader7 (Post 4494698)
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)

invader7 10-11-2011 04:38 AM

Quote:

Originally Posted by unSpawn (Post 4494723)
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


All times are GMT -5. The time now is 09:38 AM.