Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Execution of rubyfile in remote machines

Reply
Thread Tools

Execution of rubyfile in remote machines

 
 
Sampurna Mishra
Guest
Posts: n/a
 
      10-11-2006
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-forum.com/.

 
Reply With Quote
 
 
 
 
Dr Nic
Guest
Posts: n/a
 
      10-11-2006
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/read/book/17) 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/)

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

 
Reply With Quote
 
 
 
 
ara.t.howard@noaa.gov
Guest
Posts: n/a
 
      10-11-2006
On Wed, 11 Oct 2006, Sampurna Mishra wrote:

> 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-forum.com/.


http://www.linuxjournal.com/article/7922
http://www.codeforpeople.com/lib/ruby/rq/

but not on windows....

-a
--
my religion is very simple. my religion is kindness. -- the dalai lama

 
Reply With Quote
 
Sampurna Mishra
Guest
Posts: n/a
 
      10-12-2006
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/read/book/17) 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/)



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

 
Reply With Quote
 
Dr Nic
Guest
Posts: n/a
 
      10-12-2006
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-forum.com/.

 
Reply With Quote
 
Sampurna Mishra
Guest
Posts: n/a
 
      10-12-2006
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-forum.com/.

 
Reply With Quote
 
Sampurna Mishra
Guest
Posts: n/a
 
      10-13-2006
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-forum.com/.

 
Reply With Quote
 
ara.t.howard@noaa.gov
Guest
Posts: n/a
 
      10-13-2006
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
--
my religion is very simple. my religion is kindness. -- the dalai lama

 
Reply With Quote
 
Dr Nic
Guest
Posts: n/a
 
      10-13-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.


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-forum.com/.

 
Reply With Quote
 
Damjan Rems
Guest
Posts: n/a
 
      10-17-2006
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


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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
private data stashed in local/global execution context of PyEval_EvalCode disappears down the execution stack sndive@gmail.com Python 9 11-14-2007 10:31 PM
Microsoft Windows Routing and Remote Access Remote Code Execution Vulnerability imhotep Computer Security 0 06-23-2006 03:47 AM
Microsoft Windows Routing and Remote Access Remote Code Execution Vulnerability imhotep Computer Security 0 06-21-2006 02:03 AM
Remote Assistance fails to connect, remote remote host name could not be resolved Peter Sale Wireless Networking 1 12-11-2004 09:09 PM
Unable remote debugging on two Win XP machines Vladimír Kolesnik ASP .Net 0 07-29-2004 10:35 PM



Advertisments