Welcome! Log In Create A New Profile


Forward Root's mail to an external address

Posted by Akeldama 
Forward Root's mail to an external address
January 28, 2011 07:29PM
Has anyone managed to get this to work?

My Dockstar is running beautifully so far. Debian is installed and purring on a USB key, while two 1.5TB drives in external USB docks are automounted at boot time and serving files via Samba.

However, I'd like for the smartmontool daemon to notify me via email if there is a problem with one of the big boy drives. Additionally, anything sent to root I'd like forwarded to that same email address. I've tried multiple configuration schemes, but absolutely nothing is working. Aliases, .forward files, postfix configs... I'm at a loss.
Re: Forward Root's mail to an external address
January 28, 2011 10:31PM
It depends on which Mail Transfer Agent (MTA) you are using. With sendmail, you should be able to do this by adding an entry such as
root: external@address.com
to the /etc/mail/aliases file
Re: Forward Root's mail to an external address
January 29, 2011 03:31PM
For Postfix Users: Create the file ~/.forward with your e-mail adress as content :-)

Re: Forward Root's mail to an external address
January 29, 2011 10:52PM
i have it working on mine. it's sending rsync daily logs to my external email so i can keep tabs on things.

took a while to figure it out, but once i figured it out, it was really easy. I'm using webmin, but this doesn't require webmin.

here's what i did:

installed postfix

installed mailutils

edited (via webmin, but you can do it from anything) my /etc/postfix/main.cf file to include a line for my external smtp server (i'm on cox):

relayhost = smtp.east.cox.net

once you do that and restart postfix, you should be able to mail from the command line. test it. if it works, go to the next step, which is to pipe out your mail:

cat /home/toliver/rlog.txt | mail -s "BU Results" youremailaddress@gmail.com

if this works, then add that line (or something similar) to your cron file. here's the important parts to my /var/spool/cron/crontabs/root file, edited for personal content:

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.Xoicmf/crontab installed on Sat Jan 22 19:28:08 2011)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
1 8 * * * /usr/bin/rsync -av --log-file=/home/toliver/rlog.txt --temp-dir=/media/harddrive98/tmp --port=55555  --delete /media/harddrive45/ /media/harddrive$
0 13 * * * cat /home/toliver/rlog.txt | mail -s "BU Results" myemailaddress@gmail.com     #backup results
0 7 * * * rm /home/toliver/rlog.txt  #kill it

what this does is run the rysnc job, creates a log of the job, emails daily versions of the log, deletes the log, and then starts the whole thing over again.

i don't know if this is the best way to do it, but it works for me!


Your Email:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.