Simple remote FTP timed backup shell script sharing _linux Shell

Source: Internet
Author: User
Tags ftp login

Let's get to the point. The company now has 2 servers, are CentOS systems, a local (LAN), a computer in the telecommunications room. Because the work needs, the daily backup room data to the local, has been FTP login, and then downloaded to the local machine. Now hope, using the local CentOS machine, Automatic backup to Local.
The workaround is as follows:

1. Download the data that has been packaged on the machine in the remote telecommunication room. This is not difficult, a statement to fix.

Copy Code code as follows:
wget Ftp://user_name:password@ip_address:port/dir/file_name


2. Timed tasks, you need to write a script, and join the scheduled task.

A. Script. Suppose you plan to back up your remote files to the/var/www/html/back directory, and under this directory, create a new file that reads
Copy Code code as follows:

!#/bin/sh
cd/var/www/html/back/
wget FTP (the above statement)


Save As Bak.sh

B. Join a timed task. Direct Vi/etc/crontab Add the following statement on the last line

Copy Code code as follows:
* * * * ROOT/VAR/WWW/HTML/BACK/BAK.SH (where script is saved)


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

PS: The technical details involved in this article are limited to a variety of factors. You can search the next, welcome to my message, Q me.

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.