Simple and practical MySQL database backup web file backup

Source: Internet
Author: User



Installing Percona-xtrabackup

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



[email protected]:/backup# cat xtrabackup.sh  #!/bin/bash Backdir=/backup/mysql Web_page_ Backdir=/backup/user=r**t pass=a**********t logfile=innobackupex.log #备份网页文件 mytime= ' date + "%F_%H-%M-%S" ' cd& nbsp;/var/www/tar -zcf  ${mytime}_html.tar.gz html/mv ${mytime}_html.tar.gz  $web _page_backdir week= ' date +%u ' mkdir  $backdir  >> /dev/null 2>&1 if [  ! -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  "Backup failed! " >>  $logfile      exit     fi      echo  "  No global backup has been detected before, full backup once! " >>  $logfile     basedir= ' Cat /globalback '      echo  "Base    this library is   $backdir/$basedir  "   >>  $logfile exit fi if [   $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  "Backup failed! " >>  $logfile      exit     fi      ls  $backdir  | tail -n 1 > /globalback      Basedir= ' cat /globalback '     echo  ' ↓↓↓↓↓↓↓↓↓↓↓    weekly global backup split line    ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ " >>  $logfile     date " +%f %h:%m "  >>  $logfile     echo  Global backup   >>  $logfile  
   echo  Location of data backup    $backdir/$basedir     >>  $logfile     basedir= ' cat /globalback '     echo  ' base    this library is   $backdir/$basedir     >>  $logfile else    basedir= ' cat / Globalback '    last= ' ls  $backdir &nBsp; | 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  "Backup failed! " >>  $logfile      exit     fi      echo  Incremental backup     >>  $logfile     echo  "Base    This library is   $backdir/$basedir     >>  $logfile     echo  This backup is   $backdir/$incre   "  >>  $logfile     echo   "MySQL binary log file path"   >>  $logfile     grep  "^log.bin"  /etc/mysql/my.cnf  >>  $logfile fi


This article is from the "Soul Bucket" blog, please be sure to keep this source http://990487026.blog.51cto.com/10133282/1771769

Simple and practical MySQL database backup web file backup

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.