Skip to content

Instantly share code, notes, and snippets.

@maimai-swap
Created July 5, 2012 01:03
Show Gist options
  • Save maimai-swap/3050368 to your computer and use it in GitHub Desktop.
Save maimai-swap/3050368 to your computer and use it in GitHub Desktop.
mysqlのバックアップスクリプト
#!/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
@maimai-swap
Copy link
Author

slave側でやるやつ。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment