I'm trying to create simple backup script that copies some files to timestamped directory on the remote machine - this part is working quite OK, because I didn't run into issues like e.g network connectivity yet.
I would like to know what is recommended practice for checking if my files were copied correctly.
I was thinking about 2 ways to do this:
- Check file sizes/md5 before copying them and compare them with ones on remote machine
- Always copy one more file that will be copied last (like 1 byte file) and then check if it exists on remote machine.
I'd go with rsync, if it returns an exit code of 0, all is well. If it's not zero, the exit codes are well documented, so your script could tell you exactly what the problem was.