I want to do something like gzip a file, then immediately rsync it to another server so that the created gzip file will not be written on the local server. I was thinking of doing something like this… but obviously this fails.
gzip file | rsync -auv another_server
Anybody has any idea on this? Or is this even possible?
Best Answer
My usual approach to this would be to use gzip and ssh as follows:
gzip -c file | ssh user@remote.host "cat > destination.gz"
This will send the zip output over ssh straight into the file "destination.gz" on the remote host. If you're doing this manually, just enter your ssh password; if you want to do it automatically, you'll need to set up ssh keys, per something like this:
http://pkeck.myweb.uga.edu/ssh/