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 (sleep10; echo & quot; username & quot; sleep10; echo & quot; password & quot; sleep10; echo & quot; pwd & quot; sleep50; # echoexit) automatically Telnet the Shell script and execute the simple usage of the script on the 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
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.