A complete ftp remote batch shell

Source: Internet
Author: User
Article Title: a complete ftp remote batch shell. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

More than 30 remote hosts in the Organization must upgrade the program from time to time. To facilitate file transfer, sort out the following FTP batch processing programs. The main file is main. THE sh Content format is fixed, and the calling program autopro. sh files can be changed at any time according to the Transfer file and directory

The content of the main. sh file is as follows:

Hostlist = '2017. 1.1.1 198.1.1.2 198.1.1.3 ....................... '# write down the number of Host IP addresses!

Echo

Echo "----- remote FTP batch data transfer ------"

Echo-n "\ n enter the logon username:"; read username

Echo-n "Enter the User Password :"

Stty-echo # Hide the entered password

Read userpwd

Stty echo

Echo "\ n sent to the following HOST: [User name: $ username]"

Echo "$ hostlist"

Echo "\ n start the transfer program, press the Enter key to start .........."

Read goenter

For host in $ hostlist # All host IP loop statements

Do

Echo "sending data to the server $ host .........."

Sh autopro. sh $ host $ username $ userpwd # parameter 1 is the host IP address, parameter 2 is the user name, and parameter 3 is the password

Echo "data transfer is completed on the server $ host !! "

Echo "OK"

Sleep 2

Done

Echo "\ n all data transferred \ n"

The autopro. sh file contains the following content:

Ftp-niv $1 < User $2 $3 # parameters 2 and 3

Bin

Mkdir 20060415 # create a directory on the remote host

Cd 1, 20060415

Mput/20060415/readme.txt # note that the local file storage directory must be the same as the remote host directory

Bye

!

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.