Use pipe with net/ssh

Hi,

I’m trying to figure out how to use a pipe with the net/ssh class. I
want to rubify a shell command to copy a lvm volume to another machine.
The command is:

dd if=/dev/system/lvmvolume | ssh -c blowfish [email protected] dd
of=/dev/system/lvmvolume

So far i’ve come up with this:


c = Net::SSH.start( options[:destaddress], :port => 22, :username =>
‘root’, :password => remoterootpass )
c.open_channel do |channel|
channel.exec(“dd of=/root/test.img”) do |ch, success|
channel.on_data do |ch,data|
res << data
end

channel.send_data `dd if=#{options[:locallvmdevice]} 2>&1 /dev/null`
channel.eof!

end
end
c.loop


Thanks
Pim Snel

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