Search code examples
linuxbashrsyncchecksum

rsync how to do a checksum on rsync


When using rsync sometimes the rsync doesn't copy all the files done, below is my code I use. Is they a way to do a checksum or check after the rsync to see if all the files have been copied and if not try again until all files have been copied?

TEMP="/home/user/temp"
OPTS="-rav -h"

rsync $OPTS --stats [email protected]:/home/user/Local $TEMP

Solution

  • I think this is best solved by configuring rsync properly. Read the man page :) there's options (like --checksum for this).

    You can do this on your own as well:

    1. find all files in the rsync'd directory.
    2. xargs md5sum to get a checksum for all files
    3. md5sum the checksums

    If you do that on both sides (local/remote), you'll have a a checksum to compare against.