Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement Cloud Storage synchronization script

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article focuses on "how to achieve cloud storage synchronization script", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to achieve cloud storage synchronization script"!

The server used in this blog is AWS EC2, and the selected node is located in Japan, so the access speed can only be said to be acceptable. Some time ago, the static resources such as css, js and pictures on the website were put on the re-shooting cloud storage, and the access speed was significantly improved. Since the website is not licensed, you cannot use your own domain name to directly access the content on the cloud storage. You can only access it through the third-level domain name of the cloud storage.

The general steps for implementation are as follows:

1. Register and activate the cloud account

2. Add an account in "operator Management" after login, which will be used in ftp.

3. To create a space in "Space Management", it is best to select "File Space", because "Picture Space" only supports storing pictures, not even swf.

4. Space is authorized to an administrator, and the user name of ftp can be obtained in "get FTP account information". Note that the user name is actually composed of administrator name and space name.

5. Synchronize the files to the cloud.

6, do-it-yourself wordpress (listen to customer service said there is a plug-in, I did not use, do-it-yourself food and clothing, the key is that there are not too many changes), and it is done.

Although there is no way to provide rsync, automatic synchronization can also be achieved through lftp. The synchronization script used by this site is as follows (this site runs on Linux):

The code is 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

At this point, I believe you have a deeper understanding of "how to achieve cloud storage synchronization script". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report