|Don't ask to ask, just ask
Perl - Socket and Data Compressionby tptass (Sexton)
|on Jul 17, 2009 at 22:12 UTC
tptass has asked for the wisdom of the Perl Monks concerning the following question:
I am looking to transfer large amount of data through a socket from one machine to another. Usually I would just use scp or ssh, but this needs to all be done automatically, and setting up ssh keys cannot be done. I am trying to find a good way to do something link the following:tar czf - <directory> | ssh <username>@<hostname> tar xzf -
Currently I am using sysread and syswrite to read and write to the socket and can transfer a single file at a time. However, I have directories that are 6 - 10 GB in size, so I was trying to reduce the transfer cost by tarring the directory to be sent. I could tar the directory prior to sending, but that seems foolish and I may run out of space on some machines if I do that. Is there a way to pipe tar into a socket, rather than to ssh? If so, can you please provide a small snippet. Thanks!