Web pages, Web environment versions, databases, full-site backup scripts

Source: Internet
Author: User

#!/bin/bash# #WEB页面, Web Environment version, database, full station backup script # when there is a reason why the entire server cannot be recovered, use the relevant data backed up above to redo the same server date_a= ' date +%y%m%d-%h% m%s ' Mkdir -p /web_bak/${date_a}/conf &> /dev/nullmkdir -p /web_bak/${date _a}/web &> /dev/nullmkdir -p /web_bak/${date_a}/mysql &> /dev/null The configuration file under the #/etc  directory is backed up, and the environment version number information bak= "Httpd my.cnf my.cnf.d php.d php.ini" For bak  in  $bak;d o  #cp  -rfp /etc/$bak  /web_bak/${date_a}/conf &> /dev/ null  #done #  Backup corresponding software version information php -v | grep ^php &> /web_bak/${date_a} /php-version  #httpd  -v | grep  "Server version"  &> /web_bak/${ date_a}/apache-version  #mysql  -V &> /web_bak/${date_a}/mysql-version  #cat  /etc/redhat-release &> /web_bak/${date_a}/redhat-release ## /var/www/html   Backing up Web files in the entire directory Cp -rfp /var/www/html /web_bak/${date_a}/web &> /dev/null# backing up the database user_db=root # DB user name passwd_db=passwd  #DB密码localhost =127.0.0.1  #DB主机名port =3306  #DB端口name_db =mysql # Database name mysqldump --opt -u$user_db -p$passwd_db -h$localhost -p$port  $name _db  > /web_bak/${date_a}/mysql/${name_db}.sql


Web pages, Web environment versions, databases, full-site backup scripts

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.