Solved

Setup Sendmail to Transmit Nightly Backup Log File

Posted on 2011-02-27
8
637 Views
Last Modified: 2012-05-11
Hello,

I have a file server running Fedora 14.  

Every night this server runs a backup.  

I'd like to email the contents of a log file from the nightly backup to an external email address.

My server is not the mail server for my organization.  That mail server is not on-site.

How do I set up my file server to send me a transcript of a nightly job?

(Sendmail seemed like the way to do this, but I'd be happy to use another approach - as long as it works.)

Thanks!
0
Comment
Question by:SqueezeOJ
  • 5
  • 2
8 Comments
 
LVL 7

Expert Comment

by:droyden
ID: 34992962
You just need to configure the smarthost in sendmail then use the mailx program and a crontab

cat path/to/log/file.log | mail -s "Backup Report" emailaddress@gmail.com

0
 
LVL 77

Expert Comment

by:arnold
ID: 34993122
Does your backup app have an option to generate an email on completion?
As long as you have a mail server installed/running sendmail, postfix, etc. and you configure them to use your ISP mail server, that is all that it takes.

it depends on the options available within the backup app as well.
0
 

Author Comment

by:SqueezeOJ
ID: 34993958
Hello,

Thanks or your responses...

droyden: I like your approach.  The code you gave me executes without error, but doesn't seem to actually send anything to me.  (I changed the command to have real information, of course.) You mention needing to configure the smarthost.  I haven't configured anything - it's a vanilla Fedora 14 install.  What should I be doing to configure it?

arnold:  I'm not using a backup app.  I simply need to copy the contents of one file and send it to my gmail account.

Jason
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 77

Accepted Solution

by:
arnold earned 500 total points
ID: 34994049
You can use a
(echo "To: <youremail address>
From: <email address>
Subject: email with data

Body of message";
cat <filename with data>
) | /usr/sbin/sendmail -t -oi

If you have mutt installed, I find it more preferrable if one has to use a mail client application versus the sendmail route as the example above has.
0
 

Author Comment

by:SqueezeOJ
ID: 34994114
Just installed mutt and now I have a tiny little email program.  Cool.

Can't seem to get it to send external email - probably needs to be set up.

How do I configure it to login to a distant mail server and send mail from there?
0
 

Author Comment

by:SqueezeOJ
ID: 34994151
With the help of Google, I've got mutt working.

Have an example of a command-line mutt email?
0
 

Author Comment

by:SqueezeOJ
ID: 34994194
THANKS!

Your mutt tip was just what I needed to figure this out.

Here's the command line I use to send email:

mutt -s "Test Mail" me@mycompany.com < ./Desktop/log.txt

Open in new window


Add -a switch plus file path to add an attachment.

I created the mutt configuration file based on http://www.andrews-corner.org/mutt.html

Jason
0
 

Author Closing Comment

by:SqueezeOJ
ID: 34994200
Your mutt tip pointed me in the right direction.  Once I had that I was able to google my way to success....but without your help, it would've taken me much longer!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question