filename=`date +%Y%m%d_%H%M%S`
database=finebw
servername=official
createfilename=${servername}_${database}_${filename}
mysqldump -uroot -pfishjoy123456 ${database}>/mnt/mysql_data_bak/${createfilename}.sql
cd /mnt/mysql_data_bak
tar -zcvf ${createfilename}.tar.gz ${createfilename}.sql
rm -rf /mnt/mysql_data_bak/${createfilename}.sql
scp -P 922 ${createfilename}.tar.gz [email protected]:/mnt/data/remote_mysql_data_bak
find /mnt/mysql_data_bak -mtime +3 -name "${database}_*" -exec rm -rf {} \;

05-08 15:44