[root@Mysql28 shell]# cat binlog.sh
#!/bin/sh
#mysql binlog backup script
#by song
ftp_backup="D:\\dbbackup\\logbackup"
/usr/local/mysql/bin/mysqladmin -uroot -proot flush-logs
DATADIR=/usr/local/mysql/data
BAKDIR=/data/back_up/binlog
#HOSTNAME=`uname -n`
cd $DATADIR
FILELIST=`cat /usr/local/mysql/data/mysql-bin.index` ------------拿出所有的binlog文件的具体名字
COUNTER=0
for file in $FILELIST
do
COUNTER=`expr $COUNTER + 1` -------循环取出上步骤中的binlog文件列表;
done
NextNum=0
for file in $FILELIST
do
base=`basename $file`
NextNum=`expr $NextNum + 1`
if [ $NextNum -eq $COUNTER ]
then
echo "skip lastest" -------跳过最后一个binlog正在使用的文件
#!/bin/sh
#mysql binlog backup script
#by song
ftp_backup="D:\\dbbackup\\logbackup"
/usr/local/mysql/bin/mysqladmin -uroot -proot flush-logs
DATADIR=/usr/local/mysql/data
BAKDIR=/data/back_up/binlog
#HOSTNAME=`uname -n`
cd $DATADIR
FILELIST=`cat /usr/local/mysql/data/mysql-bin.index` ------------拿出所有的binlog文件的具体名字
COUNTER=0
for file in $FILELIST
do
COUNTER=`expr $COUNTER + 1` -------循环取出上步骤中的binlog文件列表;
done
NextNum=0
for file in $FILELIST
do
base=`basename $file`
NextNum=`expr $NextNum + 1`
if [ $NextNum -eq $COUNTER ]
then
echo "skip lastest" -------跳过最后一个binlog正在使用的文件