Execution of rubyfile in remote machines

Hi All,

I need to run ruby files in remote machine.
Can anybody share their knowledge how to do this.

Thanks in Advance.

Sampurna.

Sampurna Mishra wrote:

Hi All,

I need to run ruby files in remote machine.
Can anybody share their knowledge how to do this.

Capistrano (Peak Obsession) uses the
Net::SSH library to log into remote machines and execute commands.

If you want complete control, just use the Net::SSH library
(http://net-ssh.rubyforge.org/)

On Wed, 11 Oct 2006, Sampurna Mishra wrote:

Posted via http://www.ruby-forum.com/.
Linux Clustering with Ruby Queue: Small Is Beautiful | Linux Journal
http://www.codeforpeople.com/lib/ruby/rq/

but not on windows…

-a

Hi…

Thanks Dr Nic.

I installed ‘net/ssh’ module on my window machine by using
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

and then in a separate program i wrote to start a session
in a local machine like this…

require ‘net/ssh’

session = Net::SSH.start( ‘localhost’ )

session.close
Then I got following error.I am using ruby 1.8.4.

c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require__': no such file to load -- needle (LoadError) from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require’
from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/session.rb:17
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh.rb:17 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require’
from session.rb:3

Please help how to get rid of this.
Thanks in Advance.

Sampurna.

Dr Nic wrote:

Sampurna Mishra wrote:

Hi All,

I need to run ruby files in remote machine.
Can anybody share their knowledge how to do this.

Capistrano (Peak Obsession) uses the
Net::SSH library to log into remote machines and execute commands.

If you want complete control, just use the Net::SSH library
(http://net-ssh.rubyforge.org/)

Hi,

I installed ruby gem and again excuted the ruby file and got this
error.

c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/transport/session.rb:88:in
initialize': Bad file descriptor - connect(2) (Errno::EBADF) from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/transport/session.rb:88:ininitialize’
from c:/ruby/lib/ruby/1.8/timeout.rb:48:in timeout' from c:/ruby/lib/ruby/1.8/timeout.rb:76:intimeout’
from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/transport/session.rb:87:in
initialize' from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/transport/services.rb:121:inregister_services’
from
c:/ruby/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:42:in
call' from c:/ruby/lib/ruby/1.8/thread.rb:135:insynchronize’
from
c:/ruby/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:40:in
call' ... 19 levels... from c:/ruby/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/container.rb:107:indefine’
from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/session.rb:97:in
initialize' from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh.rb:47:instart’
from session.rb:7

Is the following program is right? or i am passing wrong no of
arguments in start function.

require ‘net/ssh’

session = Net::SSH.start( ‘localhost’ )

session.close

Can you please provide me some small examples to start a session in
local machine as well as in remote machine.

Help Please!!

Thanks for the swift responses.

Dr Nic wrote:

Sampurna Mishra wrote:

`require__’: no such file to load – needle (LoadError)

needle is another gem you need to install. Unfortunately the setup.rb
process doesn’t (seem) to look out for gem dependencies.

After that, you should be good. I’ve used Net::SSH on windows.

Nic

Can i please get a solution to my problem ?
Can anybody in the list share their knowledge with me.
Can anybody provide a right pointer to solve this problem.
Help will be highly appreciated.

Thanks in advance…
Sampurna
Sampurna Mishra wrote:

Hi,
I installed ruby gem and again excuted the ruby file and got this
error.
c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/transport/session.rb:88:in
initialize': Bad file descriptor - connect(2) (Errno::EBADF) from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/transport/session.rb:88:ininitialize’
from c:/ruby/lib/ruby/1.8/timeout.rb:48:in timeout' from c:/ruby/lib/ruby/1.8/timeout.rb:76:intimeout’
from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/transport/session.rb:87:in
initialize' from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/transport/services.rb:121:inregister_services’
from
c:/ruby/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:42:in
call' from c:/ruby/lib/ruby/1.8/thread.rb:135:insynchronize’
from
c:/ruby/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:40:in
call' ... 19 levels... from c:/ruby/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/container.rb:107:indefine’
from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh/session.rb:97:in
initialize' from c:/ruby/lib/ruby/site_ruby/1.8/net/ssh.rb:47:instart’
from session.rb:7

Is the following program is right? or i am passing wrong no of
arguments in start function.
require ‘net/ssh’

session = Net::SSH.start( ‘localhost’ )

session.close

Can you please provide me some small examples to start a session in
local machine as well as in remote machine.

Help Please!!

Sampurna Mishra wrote:

`require__’: no such file to load – needle (LoadError)

needle is another gem you need to install. Unfortunately the setup.rb
process doesn’t (seem) to look out for gem dependencies.

After that, you should be good. I’ve used Net::SSH on windows.

Nic

Sampurna Mishra wrote:

Can i please get a solution to my problem ?
Can anybody in the list share their knowledge with me.
Can anybody provide a right pointer to solve this problem.
Help will be highly appreciated.

Last night I was thinking about your problem: if I remember, you’re
running your ruby code from a Win32 box? You probably can’t SSH to
localhost unless you have a SSH server (so to speak) running. I don’t
think most Win32 would ever have this.

Typically you’ll SSH to a unix box. A remote one.

Nic

Le 13 oct. 06, à 06:03, Dr Nic a écrit :

Sampurna Mishra wrote:

Can i please get a solution to my problem ?
Can anybody in the list share their knowledge with me.
Can anybody provide a right pointer to solve this problem.
Help will be highly appreciated.

Last night I was thinking about your problem: if I remember, you’re
running your ruby code from a Win32 box? You probably can’t SSH to
localhost unless you have a SSH server (so to speak) running. I don’t
think most Win32 would ever have this.

Cygwin provides openssh server.

Guillaume.

Dr Nic wrote:

Sampurna Mishra wrote:

Can i please get a solution to my problem ?
Can anybody in the list share their knowledge with me.
Can anybody provide a right pointer to solve this problem.
Help will be highly appreciated.

Last night I was thinking about your problem: if I remember, you’re
running your ruby code from a Win32 box? You probably can’t SSH to
localhost unless you have a SSH server (so to speak) running. I don’t
think most Win32 would ever have this.

Typically you’ll SSH to a unix box. A remote one.

Nic

Yep you are right.

You can use PSExec from PSTools to execute any remote command on >=
WinNT box assuming you are authorized. Look at
http://www.sysinternals.com/Utilities/PsTools.html. It’s free.

by

TheR

Guillaume M. wrote:

Le 13 oct. 06, � 06:03, Dr Nic a �crit :

Sampurna Mishra wrote:

Can i please get a solution to my problem ?
Can anybody in the list share their knowledge with me.
Can anybody provide a right pointer to solve this problem.
Help will be highly appreciated.

Last night I was thinking about your problem: if I remember, you’re
running your ruby code from a Win32 box? You probably can’t SSH to
localhost unless you have a SSH server (so to speak) running. I don’t
think most Win32 would ever have this.

Cygwin provides openssh server.

Sampurna - were you using either of these options? Can you confirm that
you had an SSH server in place that you could login to via putty etc?

@guillaume + TheR - thanks for the links.

Nic

Dr Nic wrote:
Dr Nic,

SSH server is there in one linux machine to which
I can connect using putty from my windows machine
(windows xp).I need to run my ruby programs from
there and results should come to my local machine(window).

Thanks to Guillaume and TheR for the site.

Thanks
Sampurna.

Guillaume M. wrote:

Le 13 oct. 06, � 06:03, Dr Nic a �crit :

Sampurna Mishra wrote:

Can i please get a solution to my problem ?
Can anybody in the list share their knowledge with me.
Can anybody provide a right pointer to solve this problem.
Help will be highly appreciated.

Last night I was thinking about your problem: if I remember, you’re
running your ruby code from a Win32 box? You probably can’t SSH to
localhost unless you have a SSH server (so to speak) running. I don’t
think most Win32 would ever have this.

Cygwin provides openssh server.

Sampurna - were you using either of these options? Can you confirm that
you had an SSH server in place that you could login to via putty etc?

@guillaume + TheR - thanks for the links.

Nic

On Fri, 13 Oct 2006, Sampurna Mishra wrote:

Can i please get a solution to my problem ?
Can anybody in the list share their knowledge with me.
Can anybody provide a right pointer to solve this problem.
Help will be highly appreciated.

your code/net-ssh is fine:

fortytwo :~ > ruby -r rubygems -e ’ require “net/ssh”; p
Net::SSH.start(ARGV.shift).host ’ localhost
“localhost”

fortytwo :~ > ruby -r rubygems -e ’ require “net/ssh”; p
Net::SSH.start(ARGV.shift).host ’ pendrell.textdrive.com
pendrell.textdrive.com

if you’re on a windows box it’s probably virus software and/or network
configuration.

sorry couldn’t be more help - but you may want to try on another machine
or
two. you do have sshd running on the host your trying to connect to
right?
can you ssh in manually? can you show us those commands?

regards.

-a