Linux implementation of FTP automatic backup shell script _linux Shell

Source: Internet
Author: User
Use here documentation
Copy Code code as follows:

#!/bin/sh
FTP-IVN 210.29.28.124 <<eof
User Yun yun2011
Lcd/home/veyun
Cd/home/veyun/yhb
Get V
Bye
Eof


Explain:

-I: Turns off interactive prompts during multiple file transfers, so there's no hint that users can enter user names and passwords
-N: Automatic logon When initial connection is blocked
-V: Set the FTP command to verbose mode so that you can see the commands in the session

In this example, log in using the username Yun and password yun2011.

Here's a simple shell script that you wrote yourself.

Implementation objective: Download the file from Remotedir to the Localdir directory and list all Remotedir file names into Dirlist file.

Finally, the downloaded file is packaged, and the file that you just downloaded (according to the filename in dirlist) is deleted.


Script Explanation:
2-8: Defining variables
9-16:ftp Download
18-20: Packing
22: Get the filename in the Dirlist file
23-26: Get the file name, and delete the corresponding file.
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.