欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

centos中mysql備份數(shù)據(jù)庫腳本分享

 更新時間:2014年03月13日 15:36:06   作者:  
這篇文章主要介紹了centos中mysql備份數(shù)據(jù)庫腳本,可以做成mysql自動備份工具,管理網(wǎng)站一定會用的到,需要的朋友可以參考下

復(fù)制代碼 代碼如下:

#!/bin/bash
#backup mysql data

DBDIR=/data/mysql
BACKDIR=/data/bak/mysql
TIME=`date -d "today" +%F`
DB=$(ls -p $DBDIR | grep / |tr -d / | grep -Ev 'information_schema|performance_schema|mysql|test')
/etc/init.d/mysqld stop
if [ -d $BACKDIR ]
then
        echo "OK!"
else
        mkdir -p $BACKDIR
fi
cd $DBDIR
for i in $DB
do
tar czf $BACKDIR/$i\_db\_$TIME.tar.gz $i
done
/etc/init.d/mysqld start
find $BACKDIR -name "*.tar.gz" -type f -mtime +15 -exec rm {} \;  >/dev/null 2>&1

相關(guān)文章

最新評論