脚本如下:
#==========================================================
#!/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 sca@172.90.91.92:/root/DBBakDir
scp /root/DB_DIR/dbname2_"$current_date"_dump_file.sql sca@172.91.92.93:/root/DBBakDir
if [ $? -ne 0 ]
then
mail -s "Warning mesage from the automating backup program of tuscany.org.cn" wanglei@myce.net.cn < mailcontext.txt
fi
#==========================================================
mailcontext.txt的内容
==================================
Tuscany数据备份出错,请尽快查看原因并解决!