Hi James,
i''m afraid this rspec user list is not the right list for your
question.
Matthias
Am 25.04.2008 um 10:59 schrieb James George:
> 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}"
> begin
> 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"
> end
>
> channel.on_data do |ch,data|
> #puts "rcvd #{data}"
> $cmd_rslt << data
> end
> channel.send_request "shell", nil, true
> end
>
> channel.on_failure do
> puts "shell could not be started!"
> end
>
> channel.on_close do
> puts "shell terminated"
> $cmd_done = true
> end
>
> channel.request_pty :want_reply => true
> end
>
> rescue Exception => myexp
> puts myexp
> $cmd_rslt = ""
> ensure
> $cmd_done = true
> end
> end
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users