BACKUP BOTH REMOTE SOURCE AND DESTINATION PATHS ON LINUX
As the title points, the scenario is pretty much self explanatory. I had to back up a directory located in a remote server, and I wanted to save that copy on another server, all from my laptop. Let's give some names to those elements to provide a better description:
- Directory to copy: remote_server:/my/directory
- Destination path: storage_srv:/backups
Also, the format of the copy I was looking for was a basic compressed tarball. That said, the simplest but yet handy way I got to achive that was running this:
ssh -q remote_server -l my_user sudo tar czf - /my/directory | gzip -9 | ssh -q storage_srv -l my_user \ "cat - > /backups/my_directory_backed_up.tgz"
After that, a compressed copy of the whole directory located in my remote server was saved in my storage machine.