- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- mp test expect script
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
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
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
тАО02-26-2010 06:50 AM
тАО02-26-2010 06:50 AM
mp test expect script
But I am having problems with this one.
First I have a script that reads the hosts list.
#!/usr/bin/sh
for host in `cat hosts`
do
./expect2.sh $host
done
#!/usr/local/bin/expect -f
set pwd mypassword
spawn telnet [lindex $argv 0]
# username is passed as 1st arg, password as 2nd
expect "*login:"
send "mpadmin\r"
expect "*password:"
send "$pwd\r"
expect -re "(.*)>" { send "X\n" }
expect -re "(.*)login:" { send "failed $argv\n" }
expect eof
If someone can show me how to combine the scripts that would be great.
After I have this one down .. I will be working on one that changes the mp password.
Thanks
- Tags:
- expect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2010 07:02 AM
тАО02-26-2010 07:02 AM
Re: mp test expect script
expect: spawn id exp7 not open
while executing
"expect eof"
(file "./expect2.sh" line 17)
but when i take out the expect eof .. the script does not work right.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2010 07:17 AM
тАО02-26-2010 07:17 AM
Re: mp test expect script
First, your shell script isn't going to give you what you want --- a simple hostname. Instead, every whitespace delimited field of every line is going to be seen in the '$host' variable.
You could do:
#!/usr/bin/sh
grep -E "^[0-9]" /etc/hosts|while read HOST X
do
./expect2.sh ${HOST}
done
...which would find only lines beginning with a digit which should represent valid hosts.
As for "combining" the shell and the 'expect' script, why?
You would be far better served if you leave the 'expect' script as a functional, standalone script that is called however you need to call it. In this case you call it passing every hostname in an '/etc/hosts' file.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2010 07:25 AM
тАО02-26-2010 07:25 AM
Re: mp test expect script
My main issue is I get the following error ..
expect: spawn id exp7 not open
while executing
"expect eof"
(file "./expect2.sh" line 17)
but when i take out the expect eof .. the script does not work right.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2010 05:16 PM
тАО02-26-2010 05:16 PM
Re: mp test expect script
You need the 'expect eof' to wait for the last command to finish.
As for combining the shell and 'expect' scripts into one, you could use a here-document for the 'expect' script. You could create a temporary file with the here-document that constitutes the 'expect' script; 'chmod' it to be executable; call it; and when the encapsulating shell script completes, remove the temporary file that was created.
Regards!
...JRF...