An error occurred while executing the scp copy program automatically.

Source: Internet
Author: User
An error occurred while automatically executing the scp Copy Program-Linux general technology-Linux technology and application information. The following is a detailed description. I wrote a simple automatic execution scp copy program. The process of the program is basically like this. First, log on to the 206 host, and the 206 host copies a file from the 202 host to the local host. However, the following problems occur during execution:

Ssh: connect to host 192.168.0.202 port 22: Connection refused
CT: spawn id exp7 not open
While executing
"CT-nobrace-re ~ \] # {
Send "\ r"

} Timeout {
Exit 1
}"
Invoked from
"CT {
-Re "$ pai_prompt"

{
Send "\ r"

}
Timeout
{
Exit 1
}
}"
(File "auto_copy_scp.exp" line 82)



The following are all programs:


#! /Usr/bin/CT-f
Set loginuser "root"
# Set ipaddr "192.168.1.104"
Set ip202 "192.168.0.202"
Set ip206 "192.168.0.206"
Set passwd206 "123456"
Set passwd202 "123456"
# Set loginpass "123456"
# Set newpass "654321"
Set ipv_prompt "~] #"


Spawn ssh $ loginuser @ $ ip206

Set timeout 300

CT {
-Re "Are you sure you want to continue connecting (yes/no )? "
{
Send "yes \ r"
}
-Re "password :"
{
Send "$ passwd206 \ r"
}
-Re "Permission denied, please try again ."
{
Exit
}
-Re "Connection refused"
{
Exit
}
Timeout
{
Exit
}
Eof
{
Exit
}
}

CT {
-Re "password :"
{
Send "$ passwd206 \ r"
}

-Re "$ pai_prompt"
{
Send "\ r"
}
}






# Spawn passwd
Spawn scp $ loginuser @ $ ip202:/root/Win2003-32bit-sp2.iso/root

CT {
-Re "Are you sure you want to continue connecting (yes/no )? "
{
Send "yes \ r"
}
-Re "password :"
{
Send "$ passwd202 \ r"
}
Timeout
{
Exit 1
}

}
# Set timeout 30000


CT {
-Re "$ pai_prompt"

{
Send "\ r"
}
Timeout
{
Exit 1
}
}
# CT eof
Exit


Please give me some advice. Thank you!

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.