cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2163
Views
0
Helpful
4
Replies

EEM Tcl scp hangs during execution

sotiris.ioannou
Level 1
Level 1

Hi all,

I'm trying to write a script that allows the router to query for its configuration.

Every time the script reaches the following line

cli_exec $cli1(fd) "copy scp://user:pass@192.168.1.130//conf/$hostname start"

Am I missing something here ?

When I try the command via cli it works.

Thanks,

Sotiris

4 Replies 4

Joe Clarke
Cisco Employee
Cisco Employee

There were issues in older code where SSH-related commands would hang.  What version of IOS is this?

Hi Joseph,

Thanks for your reply I'm using IOS 15.1.

To get the script working at the end I issued the command "file prompt quiet" to stop the system prompt when SCP is used.

Not sure if there is a way to have an interactive communication with the system using the tcl expect or if the messages are actually pipped back to the TCL script.

Sotiris

Instead of using cli_exec, you can use cli_write, then use cli_read_pattern to look for the prompt.  Then respond to the prompt using cli_exec or another cli_write.  In this way you can interact with the command.  However, you are correct the command does need to print back to the VTY the Tcl script is running on and I believe that was the issue that Joe alluded to with SSH-related commands hanging - although I could be wrong I did not follow it that closely and it was a long while ago. 

Mike

Thanks for your reply Mike,

This keeps getting stranger and stranger, this morning the script worked perfectly no problems as I mentioned above, now I test the script again after some changes not relevant to the scp and now scp fails.

I run a debug ip scp and I get the following

SCP: SSH Client connect failed

I will try with cli_write and cli_read_pattern but I'm not holding my breath.

I have checked with the remote linux box that has the configuration stored and I do not see any packets comming from the router I'm running the script.

Sotiris

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: