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 realize remote FTP to back up Shell script regularly

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

Share

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

This article mainly explains "how to achieve remote FTP scheduled backup Shell script", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to achieve remote FTP scheduled backup Shell script" bar!

Let's start with the question. The company now has two servers, both of which are centos systems, one local (local area network) and one in the telecommunications room. Because of the need of work, the data on the computer room is backed up to the local computer every day. In the past, it was always logged in by FTP, and then downloaded to the local machine. Now I want to use the local centos machine to automatically back up to the local.

The solution is as follows:

1. Download the packaged data on the machine in the remote telecommunications room. This is not difficult, one sentence is done.

The code is as follows:

Wget ftp://user_name:password@ip_address:port/dir/file_name

two。 Scheduled task, you need to write a script and add to the scheduled task.

a. Script. Suppose you plan to back up the remote files to the / var/www/html/back directory, and create a new file in this directory, as follows

The code is as follows:

! # / bin/sh

Cd / var/www/html/back/

Wget ftp (the above statement)

Save as bak.sh

b. Add scheduled tasks. Directly vi / etc/crontab adds the following statement to the last line

The code is as follows:

30 18 * root / var/www/html/back/bak.sh (location where the script is saved)

In this way, at 6:30 every afternoon, the local centos machine automatically backs up the files of the remote FTP to / var/www/html/back.

Thank you for your reading, the above is "how to achieve remote FTP scheduled backup Shell script" content, after the study of this article, I believe you on how to achieve remote FTP scheduled backup Shell script this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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