use pipe with net/ssh

P

Pim Snel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top