Mysql数据备份以及异地存储

整理tuscany.org.cn的服务器,发现3年前写的脚本还在跑着 :)

 

脚本如下:

#==========================================================

#!/bin/bash
current_date=`date +%Y-%m-%d:%H:%M:%S`

/usr/local/mysql/bin/mysqldump -prootpass  dbname1 > ./DB_DIR/dbname1_"$current_date"_dump_file.sql 
/usr/local/mysql/bin/mysqldump -prootpass  dbname2 > ./DB_DIR/dbname2_"$current_date"_dump_file.sql


scp /root/DB_DIR/dbname1_"$current_date"_dump_file.sql [email protected]:/root/DBBakDir

scp /root/DB_DIR/dbname2_"$current_date"_dump_file.sql [email protected]:/root/DBBakDir

 

if [ $? -ne 0 ]
then
mail -s "Warning mesage from the automating backup program of tuscany.org.cn" [email protected] < mailcontext.txt
fi

 

#==========================================================

 

 

mailcontext.txt的内容

==================================

Tuscany数据备份出错,请尽快查看原因并解决!

你可能感兴趣的:(Linux使用,数据备份,mysql,date,脚本,服务器,存储)