Created
July 5, 2012 01:03
-
-
Save maimai-swap/3050368 to your computer and use it in GitHub Desktop.
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 | |
/usr/sbin/tmpwatch -m 50 /usr/local/mysqlbackup/backupdata | |
svr_name=`uname -n` | |
/usr/bin/mysqladmin stop-slave | |
sleep 10 | |
/sbin/service mysqld stop | |
sleep 10 | |
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 | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
slave側でやるやつ。