1. the command line mail tool in muttLinux can be used to receive and send mails to the mail server in sendmailpostfixLinux. All mails are sent from the local machine.
1. the required software mutt command line mail tool in Linux can be used to receive and send emails to sendmail/postfix mail servers in Linux. All emails are sent from the local machine.
1. Required Software
The command line email tool in mutt Linux, which can be used to receive and send emails.
Sendmail/postfix on the mail server in Linux, all emails are sent from the Local Machine
MySQL database backup program
2. mutt parameter Introduction
- Attachment
-S Topic
Example:
Echo "Hello, have a good time! "| Mutt-a/etc/passwd-s" Linux emails with attachments "cc2@cc2.cc
(Echo print content for the mail body, send Password File passwd to the mailbox cc2@cc2.cc)
3. Script
Database Name of the test backup:
Scriptdev2 realmd mmfpm mangos characters
View the character set used by the database
Show variables like "char % ";
Utf8
Create backup script
Vi/root/send-mysql-data.sh
#! /Bin/bash
# Power by hugwww 2009-4-11
# Set time format
Date = 'date-d "% m" date-d today + "% Y-% m-% d-% H: % M "'
Echo $ date
# Defining Arrays
Db_array = (scriptdev2 realmd mmfpm characters mangos)
# Retrieve the number of arrays without elements
LenArray =$ {# db_array [@]}
# Listing array elements cyclically
I = 0
While [$ I-lt $ lenArray]
Do
# Backup
Mysqldump-uroot-ppassw0rd -- default-character-set = utf8 -- opt -- extended-insert = false \
-- Triggers-R -- hex-blob-x $ {db_array [$ I]}>/opt/db-backup/everyday/$ {db_array [$ I]}-$ date. SQL;
# Echo $ {db_array [$ I]}
Let I ++
Done
# Compressing all SQL files into one file
Tar cvzf/opt/db-backup/mysql-data-1_date.tar.gz/opt/db-backup/everyday/* $ date. SQL
# Send the backup file to your mailbox
Echo "$ date database backup file" | mutt-a/opt/db-backup/mysql-data-.tar.gz-s "mangos database backup" cc2@cc2.cc
Echo "$ date backup succeeded and sent to the specified email address">/opt/db-backup/backup. log
Exit
Complete