Created
June 26, 2012 05:39
-
-
Save maimai-swap/2993556 to your computer and use it in GitHub Desktop.
KeepAlivedでHAした時のmysqlバックアップシェルスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/sbin/service keepalived stop | |
/usr/sbin/tmpwatch -m 50 /usr/local/mysqlbackup/backupdata | |
svr_name=`uname -n` | |
/usr/bin/mysqladmin stop-slave | |
sleep 3 | |
/sbin/service mysqld stop | |
sleep 3 | |
daystr=`date -d '1 days ago' '+%Y%m%d'` | |
cd /var/lib/mysql | |
tar czvf /usr/local/mysqlbackup/backupdata/$svr_name$daystr.tgz ./* > /dev/null 2>&1 | |
/sbin/service mysqld start | |
/usr/bin/mysqladmin start-slave | |
sleep 3 | |
/sbin/service keepalived start | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment