04-09-2013 09:37 AM
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
04-09-2013 03:19 PM
There were issues in older code where SSH-related commands would hang. What version of IOS is this?
04-10-2013 01:34 AM
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
04-10-2013 06:26 AM
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
04-10-2013 08:06 AM
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
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: