标签:shell
#!/bin/bash cd /data/backup/ /usr/local/mysql/bin/mysql -h 127.0.0.1 -u root -pxxxx -e "FLUSH TABLE WITH READ LOCK;" if [ $? = 0 ] ;then /usr/bin/innobackupex --user=root --password=chinasnto@123 --defaults-file=/etc/my.cnf --stream=tar /data/backup/ 2>`date +%F`.log | gzip 1>`date +%F`.tar.gz else exit 0 fi /usr/local/mysql/bin/mysql -h 127.0.0.1 -u root -pxxxx -e "unlock tables;" cd /data/backup/ file = "/data/backup/`date +%F`.tar.gz" if [ ! -f "$file" ] ;then rsync -av --progress --password-file=/etc/rsyncd.global --port=1873 /data/backup/ global@172.20.101.61::globalhome/ else exit 0 fi rm /data/backup/$file -f
本文出自 “湘江吹疯” 博客,请务必保留此出处http://xjcf00.blog.51cto.com/10170403/1642608
标签:shell
原文地址:http://xjcf00.blog.51cto.com/10170403/1642608