[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Execution of rubyfile in remote machines

Sampurna Mishra

10/11/2006 6:30:00 AM

Hi All,

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

Thanks in Advance.

Sampurna.

--
Posted via http://www.ruby-....

11 Answers

Dr Nic

10/11/2006 7:33:00 AM

0

Sampurna Mishra wrote:
> Hi All,
>
> I need to run ruby files in remote machine.
> Can anybody share their knowledge how to do this.

Capistrano (http://manuals.rubyonrails.com/re...) 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.ruby...)

--
Posted via http://www.ruby-....

Ara.T.Howard

10/11/2006 2:38:00 PM

0

Sampurna Mishra

10/12/2006 10:03:00 AM

0

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 (http://manuals.rubyonrails.com/re...) 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.ruby...)


--
Posted via http://www.ruby-....

Dr Nic

10/12/2006 10:05:00 AM

0

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

--
Posted via http://www.ruby-....

Sampurna Mishra

10/12/2006 11:30:00 AM

0

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.


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


--
Posted via http://www.ruby-....

Sampurna Mishra

10/13/2006 4:26:00 AM

0

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: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!!


--
Posted via http://www.ruby-....

Ara.T.Howard

10/13/2006 4:56:00 AM

0

Dr Nic

10/13/2006 10:03:00 AM

0

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

--
Posted via http://www.ruby-....

Guillaume Marcais

10/17/2006 1:30:00 PM

0

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.

> Typically you'll SSH to a unix box. A remote one.
>
> Nic
>
> --
> Posted via http://www.ruby-....
>
>


Dr Nic

10/17/2006 1:35:00 PM

0

Guillaume Marcais 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


--
Posted via http://www.ruby-....