Execution of rubyfile in remote machines

S

Sampurna Mishra

Hi All,

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

Thanks in Advance.

Sampurna.
 
S

Sampurna Mishra

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.
 
D

Dr Nic

Sampurna said:
`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
 
S

Sampurna Mishra

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:in
`initialize'
from c:/ruby/lib/ruby/1.8/timeout.rb:48:in `timeout'
from c:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout'
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:in
`register_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:in `synchronize'
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:in
`define'
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:in `start'
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.
 
S

Sampurna Mishra

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
 
A

ara.t.howard

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
 
D

Dr Nic

Sampurna said:
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
 
D

Damjan Rems

Dr said:
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
 
G

Guillaume Marcais

Le 13 oct. 06, =E0 06:03, Dr Nic a =E9crit :
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.
 
D

Dr Nic

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


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
 
S

Sampurna Mishra

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top