LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   A more efficient scp /cpio one liner (https://www.linuxquestions.org/questions/linux-server-73/a-more-efficient-scp-cpio-one-liner-910536/)

metallica1973 10-27-2011 03:14 PM

A more efficient scp /cpio one liner
 
Is there a shorter way to pass a scp copy from a remote site locally and then pass it into cpio?

Code:

scp -Crp root@192.168.0.131:/var/backups/ /home/testuser/Downloads/extract/;find /home/testuser/Downloads/extract/backups | cpio -oavc > /home/testuser/Downloads/extract/testbackup.cpio
??

colucix 10-27-2011 03:29 PM

Code:

ssh root@192.168.0.131 "find /var/backups | cpio -oavc" > /home/testuser/Downloads/extract/testbackup.cpio

metallica1973 10-27-2011 09:08 PM

awesome but will this scp the backups directly through cpio and then to the 1T media?It is a big backup and I dont have much space where the script will run from to store the files temporarily. Everything would need to occur on the 1T external drive.

So

Code:

scp -Crp testuser@192.168.5.1:/var/www/ --> cpio -oavc > /media/1T-drive/www/fullwwwsite.cpio
Also would you recommend compression while transferring this large ammount of data(500M+)? thanks

metallica1973 10-27-2011 09:25 PM

i tested it and it worked awesomely. many thanks man

colucix 10-28-2011 01:06 AM

You're welcome!

As you already noticed, on the remote machine it writes to the standard output (no disk space required) and it redirects into a local cpio file.


All times are GMT -5. The time now is 01:37 AM.