Rsync: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=== Common rsync commands === == Copy with all dot-files included == <pre> rsync -av --include='.*' . /opt/nmsApi_backup/ </pre> == Normal rsync == <pre> rsync -arHS <src> <dest> </pre> Category:Bash") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
rsync -arHS <src> <dest> | rsync -arHS <src> <dest> | ||
</pre> | </pre> | ||
== rsync over ssh with ignore existing == | |||
<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 -p 1022 -i /home/chubbard/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" chubbard@radio01:/usr/lib/* . | |||
</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 09: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