- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- expect giving problem
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
Forums
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
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
06-05-2003 09:44 AM
06-05-2003 09:44 AM
expect giving problem
this following script is failing
set username testuser
set oldpasswd tesyy344
set newpasswd 1Xe7tfyz
set timeout_org $timeout
set timeout 3
set prompt "(%|#|\\\$) "
spawn rlogin -l $username localhost
expect "assword: " {
send "$oldpasswd\r"
} timeout {
set timeout $timeout_org
send_user "Time Out\n"
exit
}
Any suggestions !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2003 11:05 AM
06-05-2003 11:05 AM
Re: expect giving problem
The README file in the distribution also describes the locaton of the Expect archive which holds even more scripts.
http://expect.nist.gov/FAQ.html
is the url for the expect FAQ
http://expect.nist.gov
is the url for the expect home page.
the home page includes links to the examples that are included with expect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2003 11:13 AM
06-05-2003 11:13 AM
Re: expect giving problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2003 11:14 AM
06-05-2003 11:14 AM
Re: expect giving problem
# xrlogin - rlogin but with current DISPLAY
#
# You can extend this idea to save any arbitrary information across rlogin
# Don Libes - Oct 17, 1991.
if {[llength $argv] != 1} {
puts "usage: xrlogin remotehost"
exit
}
set prompt "(%|#|\\$) $" ;# default prompt
catch {set prompt $env(EXPECT_PROMPT)}
set timeout -1
eval spawn rlogin $argv
expect eof exit -re $prompt
if {[string match "unix:0.0" $env(DISPLAY)]} {
set env(DISPLAY) "[exec hostname].[exec domainname]:0.0\r"
}
send "setenv DISPLAY $env(DISPLAY)\r"
interact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2003 11:16 AM
06-05-2003 11:16 AM
Re: expect giving problem
type:
autoexpect -f
then commense to logging in and doing your thing. when you hit ^d (control d) it writes to
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2003 11:16 AM
06-05-2003 11:16 AM
Re: expect giving problem
# telnet-cwd - telnet but with same directory
#
# You can extend this idea to save any arbitrary information across telnet
# Don Libes - Oct 17, 1991.
set prompt "(%|#|\\$) $" ;# default prompt
catch {set prompt $env(EXPECT_PROMPT)}
eval spawn telnet $argv
interact -o -nobuffer -re $prompt return
send "cd [pwd]\r"
interact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2003 01:56 PM
06-05-2003 01:56 PM
Re: expect giving problem
Hi All,
Finally what I was able to do is as below.
It takes both cases
1- when the password expires
2- whenever you need changing the password
Any suggestions to improve this.
#!/usr/local/bin/expect -f
#
#USAGE big_exp.exp [host] [username] [oldpw] [newpw]
set host [lindex $argv 0]
set username [lindex $argv 1]
set oldpw [lindex $argv 2]
set newpw [lindex $argv 3]
set pw_stat 0 ;# set to 1 for expired passwords
log_file /tmp/JUNK
set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
set timeout -1
spawn rlogin $host -l $username
match_max 100000
expect {
-exact "Password: " {
send "$oldpw\r"
send "$newpw\r"
send "passwd $username\n"
expect "password:"
send "$oldpw\r"
expect "password:"
send "$newpw\r"
expect "password:"
send "$newpw\r"
}
-re "expired" {
send "$oldpw\r"
send "$newpw\r"
send "$newpw\r"
}
}
send "exit\n"
send "exit\n"
expect eof
Thank You All.