Thanks,
I ended up with an indirect way as well-
def send_non_sync cmd
@session.process.open(cmd) do |command|
command.on_success do |p|
@log.debug "#{cmd} Succeeded"
end
command.on_stdout do |p,data|
yield data
end
command.on_exit do |p,status|
puts "process finished with exit status: #{status}"
return false
end
end
end
which is kind of run as -
send_non_sync("tail -f /var/log/auth.log") { |output|
grep on something in output and break...
}
Vivek Nallur wrote:> I couldn''t figure out a way to do it directly, so my hack involved
> something like this:
>
> Signal.trap ("INT") do
> kill_executable($pathToExecutable)
> end
>
> def kill_executable($path)
> start a new net::ssh connection
> create a new shell using: shell = session.shell.async
> out = shell.killall "-INT $path"
> shell.exit
> end
>
> -Vivek
>
> On 11/06/07, Sagar Sanghani <sagar at dash.net> wrote:
>> Essentially I want a way to send a command the the remote host and when
>> I see a certain string I want to break it by sending a CTRL-C
>>
>> Think tail -f running until I see a string I care about.
>>
>> Is there a way to do this?
>>
>> I''m also using the ruby serialport library and sending a
ctrl-c is as
>> simple as serial_port.putc(3) - they ASCII code for ctrl-c.
>>
>> _______________________________________________
>> Net-ssh-users mailing list
>> Net-ssh-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/net-ssh-users
>>
> _______________________________________________
> Net-ssh-users mailing list
> Net-ssh-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/net-ssh-users