心想事成
sinxadmin
全部博文(75)
Python(1)
Java(0)
Perl(6)
Shell(5)
Oracle(32)
Mysql(8)
Solaris(0)
HP(0)
AIX(0)
Linux(16)
2011年(1)
2010年(9)
2009年(65)
cynthia
浪花小雨
hongwent
damoluom
s2t61
分类:
2009-04-30 14:17:49
#!/bin/bash#configurationdb_user="root"db_password="123456"db_host="10.10.11.151"db_port="3306"db_name="crashcourse"db_bin_dir="/home/mysql/log/"db_bin_prefix="mysql"db_binbackup_dir="/dir/logbin_backup/"time_now=` date '+%Y%B%d%H%M%S' `#start#startmysqladmin -h$db_host -P$db_port -u$db_user -p$db_password flush-logscd $db_bin_dirfor i in `cat ${db_bin_prefix}-bin.index`do bin_list="$bin_list `basename $i`"donelatest=$(basename `cat ${db_bin_prefix}-bin.index|tail -n1`)backup_list=`ls $db_binbackup_dir |grep "${db_bin_prefix}-bin"`backup_latest=`ls $db_binbackup_dir|grep "${db_bin_prefix}-bin" |tail -n1`for j in $bin_listdo need_backup="YES" for k in $backup_list do if [ $j = $k ] then need_backup="NO" fi done if [ $j = $latest ] then need_backup="NO" fi if [ $j = $backup_latest ] then need_backup="YES" fi if [ $need_backup = "YES" ] then cp $j $db_binbackup_dir fidone
上一篇:mysql完全备份
下一篇:check_slave
登录 注册