Guys I’m having a problem with net-ssh, its kinda taking too long to
execute a command and give me the results. It takes around 40 seonds to
do it. And I have 3-4 commands to run on the remote box. Is there any
possibility to speed up the process. Im using the commands to run on a
CISCO BTS server. Is there any possibility that I cud keep channel or
session open as long s i could and get the results. Each command I run
depends on the result of the previous one I run. Since we have to send
the exit command to get the ondata, its not helping much in speeding the
whole process. Can anyone help me out there to speed this whole porcess.

Thanks GUys, heres the code below :

def execute_cmd(ssh_ssn, cmd_string)
  $cmd_rslt = ""
  $cmd_done = false
  puts "executing command: #{cmd_string} in session #{ssh_ssn}"
    ssh_ssn.open_channel do |channel|

      channel.on_success do
        puts "pty requested successfully!"

        channel.on_success do
          puts "shell started successfully!"
          channel.send_data cmd_string + "\n"
          channel.send_data "exit\n"

        channel.on_data do |ch,data|
          #puts "rcvd #{data}"
          $cmd_rslt << data
        channel.send_request "shell", nil, true

      channel.on_failure do
        puts "shell could not be started!"

      channel.on_close do
        puts "shell terminated"
        $cmd_done = true

      channel.request_pty :want_reply => true

  rescue Exception => myexp
    puts myexp
    $cmd_rslt = ""
    $cmd_done = true

Hi James,
i’m afraid this rspec user list is not the right list for your question.

Am 25.04.2008 um 10:59 schrieb James G.:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs