Skip to main content
Pipes implicitly continue line
Source Link
Thor
  • 17.5k
  • 3
  • 55
  • 71

Similar to what jw013 suggested in the comments with separate compression/decompression steps, i.e. combine two ssh commands with a pipe:

compress=gzip decompress=gunzip ssh remote1 "cd srcdir; tar cf - dir | $compress" | \ ssh remote2 "cd destdir; $decompress | tar xvf -" 

Note that the compression/decompression is configurable without depending on the version of tar.

Update

You could also add checksum verification into the pipe:

compress=gzip decompress=gunzip ckprg=md5sum cksum=/tmp/cksum ssh remote1 "cd srcdir; tar cf - dir | $compress | tee <($ckprg > $cksum)" | \ ssh remote2 "cd destdir; tee <($ckprg > $cksum) | $decompress | tar xvf -" ssh remote1 cat $cksum ssh remote2 cat $cksum 

Similar to what jw013 suggested in the comments with separate compression/decompression steps, i.e. combine two ssh commands with a pipe:

compress=gzip decompress=gunzip ssh remote1 "cd srcdir; tar cf - dir | $compress" | \ ssh remote2 "cd destdir; $decompress | tar xvf -" 

Note that the compression/decompression is configurable without depending on the version of tar.

Update

You could also add checksum verification into the pipe:

compress=gzip decompress=gunzip ckprg=md5sum cksum=/tmp/cksum ssh remote1 "cd srcdir; tar cf - dir | $compress | tee <($ckprg > $cksum)" | \ ssh remote2 "cd destdir; tee <($ckprg > $cksum) | $decompress | tar xvf -" ssh remote1 cat $cksum ssh remote2 cat $cksum 

Similar to what jw013 suggested in the comments with separate compression/decompression steps, i.e. combine two ssh commands with a pipe:

compress=gzip decompress=gunzip ssh remote1 "cd srcdir; tar cf - dir | $compress" | ssh remote2 "cd destdir; $decompress | tar xvf -" 

Note that the compression/decompression is configurable without depending on the version of tar.

Update

You could also add checksum verification into the pipe:

compress=gzip decompress=gunzip ckprg=md5sum cksum=/tmp/cksum ssh remote1 "cd srcdir; tar cf - dir | $compress | tee <($ckprg > $cksum)" | ssh remote2 "cd destdir; tee <($ckprg > $cksum) | $decompress | tar xvf -" ssh remote1 cat $cksum ssh remote2 cat $cksum 
Added checksum verification example
Source Link
Thor
  • 17.5k
  • 3
  • 55
  • 71

Similar to what jw013jw013 suggested in the comments with separate compression/decompression steps, i.e. combine two ssh commands with a pipe:

compress=gzip decompress=gunzip ssh remote1 "cd srcdir; tar cf - dir | $compress" | \ ssh remote2 "cd destdir; $decompress | tar xvf -" 

Note that the compression/decompression is configurable without depending on the version of tar.

Update

You could also add checksum verification into the pipe:

compress=gzip decompress=gunzip ckprg=md5sum cksum=/tmp/cksum ssh remote1 "cd srcdir; tar cf - dir | $compress | tee <($ckprg > $cksum)" | \ ssh remote2 "cd destdir; tee <($ckprg > $cksum) | $decompress | tar xvf -" ssh remote1 cat $cksum ssh remote2 cat $cksum 

Similar to what jw013 suggested in the comments with separate compression/decompression steps, i.e. combine two ssh commands with a pipe:

compress=gzip decompress=gunzip ssh remote1 "cd srcdir; tar cf - dir | $compress" | \ ssh remote2 "cd destdir; $decompress | tar xvf -" 

Note that the compression/decompression is configurable without depending on the version of tar.

Similar to what jw013 suggested in the comments with separate compression/decompression steps, i.e. combine two ssh commands with a pipe:

compress=gzip decompress=gunzip ssh remote1 "cd srcdir; tar cf - dir | $compress" | \ ssh remote2 "cd destdir; $decompress | tar xvf -" 

Note that the compression/decompression is configurable without depending on the version of tar.

Update

You could also add checksum verification into the pipe:

compress=gzip decompress=gunzip ckprg=md5sum cksum=/tmp/cksum ssh remote1 "cd srcdir; tar cf - dir | $compress | tee <($ckprg > $cksum)" | \ ssh remote2 "cd destdir; tee <($ckprg > $cksum) | $decompress | tar xvf -" ssh remote1 cat $cksum ssh remote2 cat $cksum 
added 49 characters in body
Source Link
Thor
  • 17.5k
  • 3
  • 55
  • 71

Similar to what jw013 suggested in the comments with separate compression/decompression steps, i.e. combine two sshssh commands with a pipe:

compress=gzip decompress=gunzip ssh remote1 "cd srcdir; tar cf - dir | $compress" | \ ssh remote2 "cd destdir; $decompress | tar xvf -" 

Note that the compression/decompression is configurable without depending on the version of tar.

Similar to what jw013 suggested in the comments, combine two ssh commands with a pipe:

compress=gzip decompress=gunzip ssh remote1 "cd srcdir; tar cf - dir | $compress" | \ ssh remote2 "cd destdir; $decompress | tar xvf -" 

Note that the compression/decompression is configurable without depending on the version of tar.

Similar to what jw013 suggested in the comments with separate compression/decompression steps, i.e. combine two ssh commands with a pipe:

compress=gzip decompress=gunzip ssh remote1 "cd srcdir; tar cf - dir | $compress" | \ ssh remote2 "cd destdir; $decompress | tar xvf -" 

Note that the compression/decompression is configurable without depending on the version of tar.

Source Link
Thor
  • 17.5k
  • 3
  • 55
  • 71
Loading