PDA

View Full Version : [ubuntu] Route new email and erase current



m3bik
May 5th, 2009, 10:04 AM
I have a crontab that accesses a php script on my server. The cronjob emails the root account after every job. How can I route mail to root to /dev/null? I've found a few tutorials on forwarding to /dev/null but I can't seem to get them to work on my server...

Thanks.

m3bik
May 5th, 2009, 10:33 AM
Sorry, it's not addressed to root@server it's addressed to user@server but it's the user I use as root...

m3bik
May 5th, 2009, 08:46 PM
Still no luck...

m3bik
May 6th, 2009, 03:04 AM
I've tried editing the alias file, /etc/aliases and added:


user: /dev/null

Restarted the server. The user account still gets mail...

m3bik
May 6th, 2009, 03:48 AM
I've tried creating a symlink from /var/mail/user to /dev/null and that still doesn't work! The server renames the symlink to something crazy and creates /var/mail/user again.

Dr Small
May 6th, 2009, 03:49 AM
To redirect stdout to /dev/null, you append this to the end of your crontab command:

> /dev/null

To send both stdout and stderr to /dev/null, you would use this:

> /dev/null &> /dev/null

Dr Small

m3bik
May 6th, 2009, 03:54 AM
I've added that, and I still get an email...

Dr Small
May 6th, 2009, 03:57 AM
You come in and make it soo easy.... Thanks!!
So, did that solve your problem? :)

m3bik
May 6th, 2009, 04:32 AM
So, did that solve your problem? :)

No, that response was premature... My bad. I still get emails sent to the user account after every cronjob...

m3bik
May 6th, 2009, 07:22 AM
I've started a new topic as my plan to fix this has changed...

See - http://ubuntuforums.org/showthread.php?p=7223188