HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Cisco/Expect Help
Operating System - Linux
1828445
Members
2917
Online
109977
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2004 04:29 AM
05-14-2004 04:29 AM
Cisco/Expect Help
Hello All,
I am having a bugger of a time getting this script to function. Its purpose is to log into a remote router, execute a `copy tftp run`, and exit.
The script does log into the router, but never seems to execute the `copy tftp run` portion.
Can anyone please help?
#!/usr/bin/expect -f
#
#
#
#
# usage: upload-config hostname username password configfilename
#
#
#
if { [llength $argv] < 5} {
puts "usage: upload hostname username password tftpip confgfilename"
exit 1
}
set router [lindex $argv 0]
set username [lindex $argv 1]
set password [lindex $argv 2]
set tftpip [lindex $argv 3]
set confgfilename [lindex $argv 4]
set timeout 20
log_user 0
spawn telnet $router
expect {
"Username:" {send $username\r}
}
expect {
"Password:" {send $password\r}
}
expect {
"#" {send "copy tftp run\n"}
}
expect {
"Address" {send $tftpip\r}
}
expect {
"Source" {send $confgfilename\r}
}
expect {
"Destination" {send "run\r"}
}
sleep 15
exit 0
I am having a bugger of a time getting this script to function. Its purpose is to log into a remote router, execute a `copy tftp run`, and exit.
The script does log into the router, but never seems to execute the `copy tftp run` portion.
Can anyone please help?
#!/usr/bin/expect -f
#
#
#
#
# usage: upload-config hostname username password configfilename
#
#
#
if { [llength $argv] < 5} {
puts "usage: upload hostname username password tftpip confgfilename"
exit 1
}
set router [lindex $argv 0]
set username [lindex $argv 1]
set password [lindex $argv 2]
set tftpip [lindex $argv 3]
set confgfilename [lindex $argv 4]
set timeout 20
log_user 0
spawn telnet $router
expect {
"Username:" {send $username\r}
}
expect {
"Password:" {send $password\r}
}
expect {
"#" {send "copy tftp run\n"}
}
expect {
"Address" {send $tftpip\r}
}
expect {
"Source" {send $confgfilename\r}
}
expect {
"Destination" {send "run\r"}
}
sleep 15
exit 0
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2004 07:56 AM
05-14-2004 07:56 AM
Re: Cisco/Expect Help
Script looks Ok; I did notice that the expect {
" " {send xxx } for the line in question ends with \n whereas all the others end with \r
(newline vs return)
This may have some effect.
{send "copy tftp run\n"}
vs
{Destination" {send "run\r"}
I would try replacing the \n with \r just for kicks :o)
Vern
" " {send xxx } for the line in question ends with \n whereas all the others end with \r
(newline vs return)
This may have some effect.
{send "copy tftp run\n"}
vs
{Destination" {send "run\r"}
I would try replacing the \n with \r just for kicks :o)
Vern
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2004 11:47 AM
05-14-2004 11:47 AM
Re: Cisco/Expect Help
No cisco gives a '#' at login from external that I'm aware of.
It gives a 'Name>' prompt first, then you have to jump into enabled mode before using the 'copy' command.
It'd help if you'd show us the output, the failure, when you do this command, but you'll need to change 'log_user 0' to 'log_user 1' (i.e. show you what it's doing).
It gives a 'Name>' prompt first, then you have to jump into enabled mode before using the 'copy' command.
It'd help if you'd show us the output, the failure, when you do this command, but you'll need to change 'log_user 0' to 'log_user 1' (i.e. show you what it's doing).
One long-haired git at your service...
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP