簡單實用的mysqlDatabase Backup 網頁檔案備份

來源:互聯網
上載者:User

標籤:簡單實用的mysqlDatabase Backup 網頁檔案備份



安裝percona-xtrabackup

http://990487026.blog.51cto.com/10133282/1759237



[email protected]:/backup# cat xtrabackup.sh #!/bin/bashbackdir=/backup/mysqlweb_page_backdir=/backup/user=r**tpass=a**********tlogfile=innobackupex.log#備份網頁檔案mytime=`date +"%F_%H-%M-%S"`cd /var/www/tar -zcf  ${mytime}_html.tar.gz html/mv ${mytime}_html.tar.gz $web_page_backdirweek=`date +%u`mkdir $backdir >> /dev/null 2>&1if [ ! -f  /globalback ]then    cat /dev/null > $logfile    innobackupex --user=$user --password=$pass $backdir    stat=`echo $?`    ls $backdir | tail -n 1 > /globalback    basedir=`cat /globalback`    last=`ls $backdir  | tail -n 1`    date "+%F %H:%M" >> $logfile    if [ $stat -ne 0 ]     then         echo "備份失敗!" >> $logfile     exit    fi    echo " 檢測到之前沒有做過全域備份,完全備份一次!" >> $logfile    basedir=`cat /globalback`    echo "基  本庫是 $backdir/$basedir "  >> $logfileexitfiif [ $week -eq 7 ]then    innobackupex --user=$user --password=$pass $backdir    stat=`echo $?`    incre=`ls $backdir | tail -n 1`    if [ $stat -ne 0 ]     then    date "+%F %H:%M" >> $logfile         echo "備份失敗!" >> $logfile     exit    fi    ls $backdir | tail -n 1 > /globalback    basedir=`cat /globalback`    echo "↓↓↓↓↓↓↓↓↓↓↓   每周全域備份分割線  ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓" >> $logfile    date "+%F %H:%M" >> $logfile    echo "全域備份"  >> $logfile    echo "資料備份的位置  $backdir/$basedir "  >> $logfile    basedir=`cat /globalback`    echo "基  本庫是 $backdir/$basedir "  >> $logfileelse   basedir=`cat /globalback`   last=`ls $backdir  | tail -n 1`   innobackupex --user=$user --password=$pass --incremental $backdir --incremental-basedir=$backdir/$last    stat=`echo $?`    incre=`ls $backdir | tail -n 1`    echo "" >> $logfile    date "+%F %H:%M" >> $logfile    if [ $stat -ne 0 ]     then         echo "備份失敗!" >> $logfile     exit    fi    echo "增量備份 "  >> $logfile    echo "基  本庫是 $backdir/$basedir "  >> $logfile    echo "本次備份是 $backdir/$incre "  >> $logfile    echo  "MySQL二進位記錄檔路徑"  >> $logfile    grep "^log.bin" /etc/mysql/my.cnf  >> $logfilefi


本文出自 “魂鬥羅” 部落格,請務必保留此出處http://990487026.blog.51cto.com/10133282/1771769

簡單實用的mysqlDatabase Backup 網頁檔案備份

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.