Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

start/stop 3 machine names using ssh

Status
Not open for further replies.

pcdj

Programmer
Oct 17, 2002
11
US
more help needed
1. I need to log into 3 machines simultaneous using ssh
2. enter in password for the 3 machines (password is the same on all 3 machines)
3. start all 3 machines using ./start simultaneous
4. be able to stop all 3 simultaneous using ./stop

Thanks for the help
 
1. Should be taken care of

2. Will require a special purpose procedure, you should
try this by yourself first. You could add another
macro to the menu to call this from the interactive
set.

Here is a tentative model.
proc mypasswdchange {name pw id} {
set i 0
send -i $id "passwd $name\r"
expect {
-i $id -re "$prompt1" {
send -i $id "$pw\r"
incr i
exp_continue
}

-i $id -re "$finalprompt" {
send -i $id "$pw\r"
incr i
exp_continue
}

-i $id "$shellprompt {
if {$i == 2} {
return
} else {
send_user "Possible error: only read $i counts."
return
}
}
}
return
}

Could you explain numbers three and four to me please?
You should be able to use the ~CMD macro for both of
these if they are internal commands.
 
Right now I open up 3 different command windows. In each one of the windows I log into a different machine. Once I do that I have to go to each window and cd /file. After that I go back to each window and ./start which is used to start a procedure in the cd/file. Trying to do a one window process, which allows me to log into Machine 1,2,3, then get password, go to cd /file on all three machines, then ./start on all three machines all in one shot. Thanks for the help
 
I'm afraid that if you cannot use the script I provided
to do this, or modify it in someway, or cannot provide me with the exact information (prompt strings from ssh in the order
they appear during a manual login) needed to help you
I don't believe it can be done in your case.

On my machine:
scriptname host1 host2 host3
<login process>
~CMD
Command to send to all hosts: cd /usr
~CMD
Command to send to all hosts: ./start
~QUIT



 
When I bring up the command window
[testf@mach6-test1 testf]$
at this prompt I put ssh testf@mach-test1

Then this comes up testf@mach-test1's password:

after putting the password in and hitting return

this comes up [testf@mach-test1 testf]$

at this prompt I put cd /sample

at the last prompt [testf@mach-test1 sample]$

I put ./start

and when I want to stop at the prompt I put ./stop

I need to do all of this simultaneous for

ssh testf@mach-test1 shh testf@mach-test2 ssh testf@mach-test3 enter password cd /sample then ./start ./stop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top