Sending log file to an Email Address

Jack Challen jack_challen at ocsl.co.uk
Fri Apr 21 15:12:40 UTC 2006


Andrew.Bridgeman at corusgroup.com wrote:
>              I currently run a script via cron on one of our Redhat
> machines ( ES version 3) and wanted the output log file to be sent to my
> e-mail address so that the log can be checked easier and i so i do not have

One "correct" way of doing this:

This works best if your script produces the output on STDOUT/STDERR.
Edit your crontab to define the MAILTO environmental variable (see "man 
cron" and search for "mail"). This will require setting your MTA 
correctly, such that "mail somebody at foo.bar" works correctly.

Often, you'd edit your /etc/mail/sendmail.mc (check the comments at the 
top of this file for what to do once it's edited) and set the SMART_HOST 
variable to your SMTP relay (which must be configured to allow relaying 
from your RHEL box). This can be somewhat tricky, as there's no one 
single way of setting up a mail relay.

hth
jack




More information about the redhat-list mailing list