Operating System - HP-UX
1758605 Members
2658 Online
108873 Solutions
New Discussion юеВ

send gzip -c output across network

 
SOLVED
Go to solution
Gilbert Standen_1
Frequent Advisor

send gzip -c output across network

Is there a way to telescope these 4 separate line commands into one command?

ssh serverA "gzip -c /oracle/archive/arch_FXPROD_2_12839_641074683.arc > /oracle/archive/arch_FXPROD_2_12839_641074683.arc.gz"
scp serverA:/oracle/archive/arch_FXPROD_2_12839_641074683.arc.gz /oracle/archive/.
gunzip /oracle/archive/arch_FXPROD_2_12839_641074683.arc.gz
ssh serverA "rm /oracle/archive/arch_FXPROD_2_12839_641074683.arc.gz"

The overall result is to send the file across the network compressed. At the end the .gz file at the target is uncompressed, and the .gz file at the source is deleted.

I don't want to use "scp -C" because testing on my system has shown the above steps accomplish the transfer about 66% faster than "scp -C" and all we are concerned about is minimizing use of bandwidth. The time it takes to gzip on the source side doesn't matter in this situation.

I just wondered if there was a more elegant solution to just sort of send the output of "gzip -c" across the network directly.
If I could take one thing with me into the next world it would be my valid login to HP ITRC Forums
4 REPLIES 4
Steven Schweda
Honored Contributor
Solution

Re: send gzip -c output across network

You mean like this, only without the "tar"?

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1222875

If you don't like the benefits offered by
"tar", then toss the "tar", and use "cat" or
input redirection.

If you have doubts about the "cd" commands
failing, then "&&" might be better than ";"
in there.
Olivier Masse
Honored Contributor

Re: send gzip -c output across network

I'm surprised that scp -C doesn't do the trick. But in your case I'd do this without an intermediate file, such as:

ssh serverA "gzip -c /oracle/archive/arch_FXPROD_2_12839_641074683.ar" | gunzip > /oracle/archive/arch_FXPROD_2_12839_641074683.arc


Dennis Handly
Acclaimed Contributor

Re: send gzip -c output across network

>Steven: use "cat" or input redirection.

cat would only be needed if the file is > 2 Gb, unless you have a large file capable gzip.
Gilbert Standen_1
Frequent Advisor

Re: send gzip -c output across network

Olivier that was exactly what was needed. Thanks to all for excellent responses.
If I could take one thing with me into the next world it would be my valid login to HP ITRC Forums