- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Expect/TCL Help!
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
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
Community
Resources
Forums
Blogs
- 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
03-05-2012 02:59 PM
03-05-2012 02:59 PM
Expect/TCL Help!
Hello TCL Gurus,
I am using an Expect/TCL script to change HP-UX console passwords. The script works for rx2660, rx3600 & rx7640 type consoles. However it fails for a rx2800 type console.
Here it fails soon after logging in:
MP MAIN MENU:
CO: Console
VFP: Virtual Front Panel
CM: Command Menu
CL: Console Log
SL: Show Event Logs
HE: Main Help Menu
X: Exit Connection
[cons-mlxg0d02]</> hpiLO->
Here are the error messages from the scipt. The line in red shows where the failure is. The rest are the remaining error messages:
password not changed on xxx.xxx.xxx.xxx - could not log in (or unrecognized prompt)
invoked "continue" outside of a loop
while executing
"expect -re "(login|Username):.*" {
send "$user\r"
if ![info exists prompt] {
if {[ string match $user "root" ]} {
set prompt "# "
} else {
..."
(file "./passlans_cmdline" line 79)
mlxg0s15:/home/sselva/TCL #
My gut instinct tells me that the failure is taking place at the line below underlined and in red:
expect -re "(login|Username):.*" {
send "$user\r"
if ![info exists prompt] {
if {[ string match $user "root" ]} {
set prompt "# "
} else {
set prompt "(%|\\\$|#|GSP\>|MP\>|Root\>) "
}
}
set logged_in 0
while {1} {
expect "*assword*" {
# If it asks for password, send the password followed by the signals
for both
# the RP-5470 (ctrl-Ecf) and the later MP (ctrl-B) to send either to
the active
# main menu.
send "$password(login)\r^Ecf\n\n^B"
} eof {
badhost $host "spawn failed"
break
} timeout {
badhost $host "could not log in (or unrecognized prompt)"
exec kill $pid
expect eof
break
} -re "incorrect|invalid|login:" {
badhost $host "bad password or login"
exec kill $pid
expect eof
break
} -re $prompt {
set logged_in 1
break
}
}
if (!$logged_in) {
wait
continue
}
Can some of you TCL gurus let me kow the following?
- If the problem is at the "send $password" line in red?
- If so what should the correct string of chjaracters be?
All helpful responses will be greatly appreciated?
Thanks in Advance,
Suren S.
- Tags:
- expect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2012 07:24 AM
03-06-2012 07:24 AM
Re: Expect/TCL Help!
It appears that it is having problems matching a prompt somewhere in the output you are getting.
Try running your program with the '-d' option.
For example:
# expect -d myprogram
Then check the output and see where your failure to match is occurring.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2012 12:03 PM
03-06-2012 12:03 PM
Re: Expect/TCL Help!
When I ran expect with the "-d" option, I got the following response:
password not changed on 10.1.16.102 - could not log in (or unrecognized prompt)
expect: does "" (spawn_id exp0) match glob pattern "\u0003"? no
expect: read eof
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "********\r\n\r\n\r\n Hewlett-Packard Integrated Lights-Out 3 for Integrity\r\n\r\n (C) Copyright 1999-2010 Hewlett-Packard Development Company, L.P.\r\n\r\n MP Host Name: cons-mlxg0d02\r\n\r\n iLO MP Firmware Revision 01.30.30\r\n\r\n\n MP MAIN MENU:\r\n\n CO: Console\r\n VFP: Virtual Front Panel\r\n CM: Command Menu\r\n CL: Console Log\r\n SL: Show Event Logs\r\n HE: Main Help Menu\r\n X: Exit Connection\r\n\n[cons-mlxg0d02]</> hpiLO-> "
write() failed to write anything - will sleep(1) and retry...
invoked "continue" outside of a loop
while executing
"expect -re "(login|Username):.*" {
send "$user\r"
if ![info exists prompt] {
if {[ string match $user "root" ]} {
set prompt "# "
} else {
..."
(file "./passlans_cmdline" line 79)
tty_set: raw = 5, echo = 0
mlxg0s15:/home/sselva/TCL #
I have only included the last part after the failure. Doea any of this make sense?
-Suren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2012 02:50 PM
03-06-2012 02:50 PM
Re: Expect/TCL Help!
Can you attach the complete run of the expect script so that we can see what occurred before the error message as well?