Re: Net::SSH serialized commands
- From: lyrics <robin.cyril@xxxxxxxxx>
- Date: Wed, 14 Jan 2009 14:15:19 -0800 (PST)
On 14 jan, 22:12, "Sebastian W." <switt...@xxxxxxxxx> wrote:
lyrics wrote:
Hi,
I am using Net::SSH v2
I want to execute a command when the first one is complete.
But I can't make it working.
Here is my code:
Net::SSH.start( addr, user, :password => passwd) do |session|
session.exec! ("service X restart")
session.exec!("<command to configure service X>")
end
The issue is that the second "session.exec!" is executed before
service is restarted.
I guess I am not doing the right way but I don't know how to do it.
Can someone help me,please?
lyrics
Not sure if this would accomplish what you are looking for, but you
could try just doing this:
Net::SSH.start( addr, user, :password => passwd) do |session|
session.exec! ("service X restart; <command to configure service X>")
end
--
Posted viahttp://www.ruby-forum.com/.
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;")
session2.exec! ("<command...>")
session1.exec! ("<command ...>")
end
end
.
- Follow-Ups:
- Re: Net::SSH serialized commands
- From: Sebastian W.
- Re: Net::SSH serialized commands
- References:
- Net::SSH serialized commands
- From: lyrics
- Re: Net::SSH serialized commands
- From: Sebastian W.
- Net::SSH serialized commands
- Prev by Date: Re: look at code in a gem
- Next by Date: Re: Net::SSH serialized commands
- Previous by thread: Re: Net::SSH serialized commands
- Next by thread: Re: Net::SSH serialized commands
- Index(es):
Relevant Pages
|