[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Net::SSH calls hanging

John Allen

3/9/2009 8:16:00 PM

All,

I'm trying to launch a server remotely, but all the Net:SSH calls I try
never seem to return...they just hang.

My Code:

cmd = "nohup ./Servers/BARKSproxy.pl &"

Net::SSH.start(host[:ip], host[:user], :password => host[:passwd]) do
|ssh|
rc = ssh.exec(cmd)

or

rc = ssh.exec!(cmd)

or

ssh.open_channel do |ch|
ch.exec(cmd) do |cc, success|
abort "Could not run program" unless success

cc.on_data do |dd, data|
puts "STDOUT>>#{data}"
end

cc.on_extended_data do |ch, type, data|
puts "STDERR>>#{data}"
end

cc.on_eof do |ch|
puts "EOF>>"
ch.close
end

cc.on_close do |ch|
puts "Channel is Closing!"
end

end
end
ssh.loop
end

All of these never return from the exec call. I am using Net::SSH v2.

I am running the program from my PC to a large HP/UX host. The
'BARKSproxy.pl' program starts and is running...but my local ruby
program never returns. The 'Timeout' options doesn't seem to be working
either, as it will sit overnight, never returning. It looks like its
locked up.

Is there some special way to start a background process using SSH??
I've tried using another perl script to start the other one, but still
get a hung exec. ..getting ready to pull what little hair is left, out
:(
--
Posted via http://www.ruby-....

2 Answers

John Allen

3/10/2009 8:35:00 PM

0

Upgraded to Net::SSH v2.0.11 ... still have the same problem :(
--
Posted via http://www.ruby-....

lyrics

3/17/2009 12:47:00 PM

0

On Mar 10, 9:34 pm, John Allen <john.al...@exonets.com> wrote:
> Upgraded to Net::SSH v2.0.11 ... still have the same problem :(
> --
> Posted viahttp://www.ruby-....

Hi,
I had the same problem.
Make sure your perl script isn't using stdin/stderr/stdout.

try :
cmd = "nohup ./Servers/BARKSproxy.pl 2>&1 1>/dev/null 0>/dev/null &"