Execution of rubyfile in remote machines

Discussion in 'Ruby' started by Sampurna Mishra, Oct 11, 2006.

  1. 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/.
    Sampurna Mishra, Oct 11, 2006
    #1
    1. Advertising

  2. Sampurna Mishra

    Dr Nic Guest

    Dr Nic, Oct 11, 2006
    #2
    1. Advertising

  3. Sampurna Mishra

    Guest

    , Oct 11, 2006
    #3
  4. 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/.
    Sampurna Mishra, Oct 12, 2006
    #4
  5. Sampurna Mishra

    Dr Nic Guest

    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/.
    Dr Nic, Oct 12, 2006
    #5
  6. 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/.
    Sampurna Mishra, Oct 12, 2006
    #6
  7. 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/.
    Sampurna Mishra, Oct 13, 2006
    #7
  8. Sampurna Mishra

    Guest

    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
    , Oct 13, 2006
    #8
  9. Sampurna Mishra

    Dr Nic Guest

    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/.
    Dr Nic, Oct 13, 2006
    #9
  10. Sampurna Mishra

    Damjan Rems Guest

    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/.
    Damjan Rems, Oct 17, 2006
    #10
  11. Le 13 oct. 06, =E0 06:03, Dr Nic a =E9crit :

    > 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
    >
    > --=20
    > Posted via http://www.ruby-forum.com/.
    >
    >
    Guillaume Marcais, Oct 17, 2006
    #11
  12. Sampurna Mishra

    Dr Nic Guest

    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-forum.com/.
    Dr Nic, Oct 17, 2006
    #12
  13. 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 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-forum.com/.
    Sampurna Mishra, Oct 18, 2006
    #13
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vladimír Kolesnik

    Unable remote debugging on two Win XP machines

    Vladimír Kolesnik, Jul 29, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    390
    Vladimír Kolesnik
    Jul 29, 2004
  2. Shafter
    Replies:
    1
    Views:
    3,332
    bruce barker
    Jan 7, 2005
  3. hokieghal99

    local interpreter remote machines

    hokieghal99, Jan 5, 2004, in forum: Python
    Replies:
    4
    Views:
    387
    Irmen de Jong
    Jan 5, 2004
  4. yoda
    Replies:
    0
    Views:
    308
  5. George Flaherty
    Replies:
    1
    Views:
    373
Loading...

Share This Page