Everytime I log on to my linux server, after I open the console terminal, I recieve a lot of email notification about crontab has done on its task. Messages notification on cronjob minutely, hourly, daily job, blah blah blah .... I dont really care about these actually, but it keeps sending me these email. I saw them as spam-mail no more. I really get upset with them.
After a while for investigating what happen with my cronjob configuration, I realize that by default, the cron daemon will send an email to root account after finishing one task. I see this is not really important so I decide to make change to the configuration file to disable the crontab sending email alert.
After a while for investigating what happen with my cronjob configuration, I realize that by default, the cron daemon will send an email to root account after finishing one task. I see this is not really important so I decide to make change to the configuration file to disable the crontab sending email alert.

As you can see in the cron log file, when done a task, it will fire an email to notify.
Server# tail /var/log/cron
localhost run-parts(/etc/cron.hourly)[1906]: finished 0anacron
localhost run-parts(/etc/cron.hourly)[1895]: starting 1.ssh
localhost run-parts(/etc/cron.hourly)[1913]: finished 1.ssh
You have new mail in /var/spool/mail/root
Server# mail
Heirloom Mail. Type ? for help.
"/var/spool/mail/root": 13 messages 13 new
>N 1 Cron Daemon Fri Jun 15 00:50 24/779 "Cron <root@it-test001> run-parts /etc/cron.hourly"
N 2 Cron Daemon Fri Jun 15 00:51 24/779 "Cron <root@it-test001> run-parts /etc/cron.hourly"
N 3 Cron Daemon Fri Jun 15 00:52 24/779 "Cron <root@it-test001> run-parts /etc/cron.hourly"
N 4 Cron Daemon Fri Jun 15 00:53 24/779 "Cron <root@it-test001> run-parts /etc/cron.hourly"
N 5 Cron Daemon Fri Jun 15 00:54 24/779 "Cron <root@it-test001> run-parts /etc/cron.hourly"
...
To fix this is really simple, I just open the crontab file and change the mailto parameters to blank.CentOS# vim /etc/crontab
Thank you
ReplyDeletenot working on centos 6 :(
ReplyDelete