Created
December 24, 2013 08:39
-
-
Save spidersea/8110447 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE=$(date +%Y%m%d) | |
/usr/local/webserver/mysql/bin/mysqldump -u root -ppasswd --opt dbname > $DATE | |
tar cfz $DATE.tar.gz $DATE | |
(echo "$DATE DB backup";uuencode $DATE.tar.gz $DATE.tar.gz)|mail -s "${DATE}_pangxiang_DB_backup" [email protected] | |
############################### | |
#也可以使用如下命令进行附件发送,效果也不错 | |
#echo "$DATE DB backup" |mutt -s "${DATE}_DB_backup" [email protected] -a ${DATE}_all-databases.sql.tar.gz | |
# | |
## rpm -qf /usr/bin/mutt | |
#mutt-1.5.20-2.20091214hg736b6a.el6_1.1.x86_64 | |
############################### | |
rm -f $DATE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment