Linux system automatically backs up files and uses Send mail

Source: Internet
Author: User
Tags auth how to send mail mysql backup

It suddenly occurred to me today that it would be nice if the server could send a daily MySQL backup to my mail. I also do not need to go to the server every day to download backup files, and this machine can also appear hard disk mechanical failure, if you can send to my mailbox, that is the mail server to ensure that my attachment security! That is not a very cool rhythm, say dry! Ma ni, how to send mail ah. All right, find a mother.

Step1: Configuring Information for SMTP

The code is as follows Copy Code

[Root@smala ~]# vi/etc/mail.rc

At the end of the file and add two lines (here I use the Tencent SMTP server for testing, you can replace the SMTP information you need)

The code is as follows Copy Code

Set from=534917582@qq.com smtp=smtp.qq.com
Set smtp-auth-user=534917582 smtp-auth-password= your password smtp-auth=login

OK, configuration complete, we are now starting to send mail

The code is as follows Copy Code

[Root@smala mysqlbak]# echo "Mail Content" | Mail-s "Mail title" penggangma@126.com

Can you send an email (-_-!), a good deal for sending backup files, Nani?

The code is as follows Copy Code

[Root@smala mysqlbak]# echo "mysql bak content" | Mail-s "2014-6-3 mysql bakfile www.111cn.net"-a/web/backup/mysqlbak/bbs.2014-05-29-17-05-12.sql penggangma@126.com

Plus the-a parameter specifies the absolute path of the attachment, go.

Recently a lot of websites to pick my page is not to bring the source, O (???) O Alas, lazy to write I understand, but the diligent delete I add the website connection you diligently deleted, I just want to say to you: hehe ~ ~ ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.