and shoot the cloud storage synchronization script _linux Shell

Source: Internet
Author: User
Tags glob

This blog uses the server is AWS EC2, select the node is located in Japan, so the speed of access can only be said. Some time ago the site's CSS, JS and pictures and other static resources on the cloud storage, access speed significantly improved a lot. Because the site did not record, so can not use their own domain name to directly access and shoot the contents of the cloud storage, only through the cloud storage of the three-level domain name to access.

The approximate steps are as follows:

1, register and activate and shoot cloud account;

2, login in the "operator management" to add an account number in the FTP will be used;

3, "Space management" to create a space, note that it is best to choose "File class Space", because "picture class space" only supports the storage of pictures, and even SWF can not be stored;

4, space authorization to an administrator, in the "Get FTP account Information" can get the FTP user name, note that the user name is actually composed of the administrator name and space name;

5, synchronized files to the cloud;

6, their own hands to modify the WordPress (insofar clothing said that there are plug-ins, I did not use, their hands and clothes, the key is to modify the place is not too much), accomplished.

While the cloud does not provide a way to rsync, but through lftp can also do automatic synchronization. This station uses the synchronization script as follows (this station runs on the Linux):

Copy Code code as follows:

#!/bin/bash

Host= "V0.ftp.upyun.com"
User= "Your FTP Username"
pass= "Your FTP Password"
lcd= "Your Website Root Dir"
Rcd= "/"

Lftp-c "Open ftp://v0.ftp.upyun.com
User $USER $PASS;

LCD $LCD;

CD $RCD;

Mirror--reverse--delete--dereference--verbose \
--exclude-glob=*.php \
--exclude-glob=*.txt \
--exclude-glob=*.xml \
--exclude-glob=*.htm \
--exclude-glob=*.html \
--exclude-glob=*.gz \
--EXCLUDE-GLOB=*.PSD \
--exclude-glob=*.mo \
--EXCLUDE-GLOB=*.PO \
--exclude-glob=*.pot \
--exclude-glob=arthemia/\
--exclude-glob=ad/\
--exclude-glob=report/\
--verbose

"

These scripts need to be modified according to their actual circumstances, such as user name, password, and the root directory of the site. Note: The quotation marks after the parameter "-C" correspond to the last quotation mark, Exclude-glob exclude the file, so that it is not synchronized to the cloud, can be a specific file or directory.

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.