Back up the shell script code of the website content

Source: Internet
Author: User

Back up website content Copy codeThe Code is as follows :#! /Bin/bash
# Specify the running script shell
# Run the script to grant the user the execution permission
Bakdir =/backup
Month = 'date + % m'
Day = 'date + % d'
Year = 'date + % y'
Hour = 'date + % k'
Min = 'date + % m'
Dirname = $ year-$ month-$ day-$ hour-$ min
Mkdir $ bakdir/$ dirname
Mkdir $ bakdir/$ dirname/conf
Mkdir $ bakdir/$ dirname/web
Mkdir $ bakdir/$ dirname/db
# Backup conf, Detected
Gzupload = upload. tgz
Cp/opt/apache2/conf/httpd. conf $ bakdir/$ dirname/conf/httpd. conf
Cd/opt/apache2/htdocs/php
Tar-zcvf $ bakdir/$ dirname/web/$ gzupload./upload
# The remote copy directory must have the write permission
Scp-r/backup/$ dirname root@10.1.1.178:/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.