On 14 jan, 22:12, “Sebastian W.” firstname.lastname@example.org wrote:
could try just doing this:
Net::SSH.start( addr, user, :password => passwd) do |session|
ï¿½session.exec! ("service X restart; ")
Thanks for replying.
The solution isn’t suitable.
I need to execute other commands on another ssh connexion.
Actually, my code is more like this:
Net::SSH.start( addr, user, :password => passwd) do |session1|
Net::SSH.start( addr2, user2, :password => passwd2) do |session2|
session1.exec! (“service X restart;”)
session1.exec! ("<command …>")
Hm…that looks a bit odd to me. Why do the sessions have to be nested?
If you need to do more advanced stuff - which it sounds like - “exec!”
probably will not suffice as it is just a convenience method.
Here is the Net::SSHv2 docs, they’re very helpful:
What you are likely looking for is to use Net::SSH::Multi (maybe), build
up an aggregated event loop, and then run it with the “loop” method.