Rsync: Difference between revisions

From I Will Fear No Evil
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 14: Line 14:
<pre>
<pre>
rsync -arHS --ignore-existing -e "ssh -i /home/chubbard/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" chubbard@radio01:/usr/lib/arm-linux-gnueabihf/* .
rsync -arHS --ignore-existing -e "ssh -i /home/chubbard/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" chubbard@radio01:/usr/lib/arm-linux-gnueabihf/* .
rsync -arHS --ignore-existing -e "ssh -i /home/chubbard/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" chubbard@radio01:/usr/lib/* .
rsync -arHS --ignore-existing -e "ssh -p 1022 -i /home/chubbard/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" chubbard@radio01:/usr/lib/* .
</pre>
</pre>
== very useful rsync with recovery ==
Keep trying to rsync files over until all files arrive at the destination (or at least rsync thinks they did).  If you have a massive number of files you can add date commands in there to say when it starts and finishes as well... Dont use time, it might give its own exit 0 that would clobber your logic for rsync.
<pre>
alias rsyncResume='rsync -arHS --partial --progress'
complete=1; while [[ $complete -gt 0 ]]; do rsyncResume <src> <dest> ; $complete=$? ; sleep 30 ; done
</pre>


[[Category:Bash]]
[[Category:Bash]]

Latest revision as of 10:38, 24 July 2024

Common rsync commands

Copy with all dot-files included

rsync -av  --include='.*' . /opt/nmsApi_backup/

Normal rsync

rsync -arHS <src> <dest>

rsync over ssh with ignore existing

rsync -arHS --ignore-existing -e "ssh -i /home/chubbard/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" chubbard@radio01:/usr/lib/arm-linux-gnueabihf/* .
rsync -arHS --ignore-existing -e "ssh -p 1022 -i /home/chubbard/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" chubbard@radio01:/usr/lib/* .

very useful rsync with recovery

Keep trying to rsync files over until all files arrive at the destination (or at least rsync thinks they did). If you have a massive number of files you can add date commands in there to say when it starts and finishes as well... Dont use time, it might give its own exit 0 that would clobber your logic for rsync.

alias rsyncResume='rsync -arHS --partial --progress'
complete=1; while [[ $complete -gt 0 ]]; do rsyncResume <src> <dest> ; $complete=$? ; sleep 30 ; done