unix command from ruby win32

N

nkb

Hi.

I would like to run a simple command on a remote unix machine from my
windows desktop. would this possible in ruby? I would like to run things
like a make, ls -l, commands. Has anyone done this before?
 
J

James Britt

Robert said:
You'll likely need a Ruby ssh client
http://raa.ruby-lang.org/project/net-ssh/

Then the rest should be easy:
http://net-ssh.rubyforge.org/chapter-4.html

I've recently looked into using this shh library on Win2k, but have run
into a problem. When running even simple code, I get a message box that
tells me, "The ordinal 2586 could not be located in the dynamic link
library LIBEAY32.dll"

Does anyone know what causes this error, and how to fix it?

I've seen in the net-ssh docs that the code may need a current version
of OpenSSL; I think I have that, running the most recent one-click
installer of Ruby 1.8.2 on Windows.

Any ideas?


Thanks,

James Britt
 
J

James Britt

James said:
I've recently looked into using this shh library on Win2k, but have run
into a problem. When running even simple code, I get a message box that
tells me, "The ordinal 2586 could not be located in the dynamic link
library LIBEAY32.dll"

Does anyone know what causes this error, and how to fix it?

Jamis Buck, who just happens to be sitting in front of me here at
RubyConf2004, has informed me that this is an issue related to
openssl.so on Win32, so investigated a bit.

I found this site
http://www.slproweb.com/products/Win32OpenSSL.html

and installed "Win32 OpenSSL v0.9.7d"

I told the installer to overwrite the existing libs when prompted.

I now get different errors, but they make more sense.


James Brit
 
J

James Britt

James said:
Jamis Buck, who just happens to be sitting in front of me here at
RubyConf2004, has informed me that this is an issue related to
openssl.so on Win32, so investigated a bit.

I found this site
http://www.slproweb.com/products/Win32OpenSSL.html

and installed "Win32 OpenSSL v0.9.7d"

I told the installer to overwrite the existing libs when prompted.

I now get different errors, but they make more sense.

But, sadly, this test
ruby -ropenssl -e "p OpenSSL::pKey::DH.instance_method:)g)"

fails, so something is still out of date
 
J

Jamis Buck

James said:
But, sadly, this test
ruby -ropenssl -e "p OpenSSL::pKey::DH.instance_method:)g)"

fails, so something is still out of date

What message do you get when it fails?

What version of Ruby are you using? (You said the one-click installer,
so I assume you're using the latest-and-greatest.) And do you have
OpenSSL for Ruby installed? Last I heard, it did not come with the
one-click installer...

- Jamis
 
J

James Britt

Jamis said:
What message do you get when it fails?




c:\>ruby -ropenssl -e "p OpenSSL::pKey::DH.instance_method:)g)"
-e:1:in `instance_method': undefined method `g' for class
`OpenSSL::pKey::DH' (NameError)
from -e:1



c:\>ruby -v
ruby 1.8.2 (2004-07-29) [i386-mswin32]
What version of Ruby are you using? (You said the one-click installer,
so I assume you're using the latest-and-greatest.) And do you have
OpenSSL for Ruby installed? Last I heard, it did not come with the
one-click installer...

I think it is part of the distro now.

http://www.ruby-doc.org/stdlib/libdoc/openssl/rdoc/classes/OpenSSL.html

Thanks,

James
 
V

Ville Mattila

I think it is part of the distro now.

I've got a working net-ssh on win32, but I had to compile ruby myself.
the oneclick installer do not have a openssl extension compiled.

The OpenSSL extension is optionally compiled if the ruby configuration
system locates OpenSSL headers and libraries. In other words if your
OpenSSL files are e.g in c:\openssl, you have to set
INC environment variable like set INC=%INC%;c:\openssl\include and
LIB environment variable liek set LIB=%LIB%;c:\openssl\lib. You also
have to put c:\openssl\lib to PATH environment variable so that dynamic
loader can find them when requiring openssl.so. Once these variables are
set correctly, you have to compile ruby sources and hopefully ruby
openssl extensionis compiled as well.
 

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

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,416
Latest member
LionelQ387

Latest Threads

Top