From: Pim Snel Date: 2011-02-16T22:37:24+09:00 Subject: 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 root@remotehost 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 -- Posted via http://www.ruby-forum.com/.