Automatically Telnet Shell scripts and execute scripts on remote machines

Source: Internet
Author: User

Simple usage of Shell script automatic Telnet and execute script of remote machine [plain] #! /Bin/sh (sleep 10; echo "username"; sleep 10; echo "password"; sleep 10; echo "pwd"; sleep 50; # echo exit) | telnet $ ip: connect to the remote machine and check the current directory. Username/password is the username used to telnet to the remote machine. The password sleep is a waiting time, which is set based on the specific machine status or the time required to execute commands. Use [plain] # With variables! /Bin/sh username = "user1" password = "password" ip = "hostIp" Cmd1 = "cd/path" Cmd1 = "source test. sh "# start (sleep 10; echo $ username; sleep 10; echo $ password; sleep 10; echo $ Cmd1; sleep 30; echo $ Cmd2; sleep 50; # echo exit) | telnet $ ip # end

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.