Mysql 定时备份(mysqldump)
#!/bin/bash today=`date +%Y-%m-%d` deleday=`date -d '7 day ago' +%Y-%m-%d` path=/home/data/mysqlbackup cd $path mysqldump -P3307 -h192.168.2.202 -uroot -p123456 --opt x1 | gzip > x1.sql.$today.gz mysqldump -h192.168.2.209 -uroot -proot123 --opt x2 | gzip > x2.sql.$today.gz sleep 2 scp -P 65000 x1.sql.$today.gz 192.168.2.109:$path/ scp -P 65000 x2.sql.$today.gz 192.168.2.109:$path/ sleep 2 rm -f x1.sql.$deleday.gz rm -f x2.sql.$deleday.gz ssh -p 65000 192.168.2.109 /bin/rm -f $path/x1.sql.$deleday.gz ssh -p 65000 192.168.2.109 /bin/rm -f $path/x2.sql.$deleday.gz