Class Hydra::SSH
In: lib/hydra/ssh.rb
Parent: Object

Read and write with an ssh connection. For example:

  @ssh = Hydra::SSH.new(
    'localhost', # connect to this machine
    '/home/user', # move to the home directory
    "ruby hydra/test/echo_the_dolphin.rb" # run the echo script
  )
  @message = Hydra::Messages::TestMessage.new("Hey there!")
  @ssh.write @message
  puts @ssh.gets.text
    => "Hey there!"

Note that what ever process you run should respond with Hydra messages.

Methods

close   new  

Included Modules

Open3 Hydra::MessagingIO

Public Class methods

Initialize new SSH connection. The first parameter is passed directly to ssh for starting a connection. The second parameter is the directory to CD into once connected. The third parameter is the command to run So you can do:

  Hydra::SSH.new('-p 3022 user@server.com', '/home/user/Desktop', 'ls -l')

To connect to server.com as user on port 3022, then CD to their desktop, then list all the files.

Public Instance methods

Close the SSH connection

[Validate]