Hacker News new | ask | show | jobs
by 369548684892826 816 days ago
Yeah, I use rsync with `-cavin`, if the output includes `>` or `<` then there are differences in checksums.

  #!/bin/bash
  hostname=$(hostname)
  checksumFile=/tmp/checksum-file.txt
  
  rsync -cavin --info=name2 --no-perms --no-owner --no-group /srv/data/photos/ user@remote:/media/data/rsnapshot/daily.0/srv/data/photos/ > $checksumFile
  
  minimumSize=5000
  actualSize=$(wc -l <"$checksumFile")
  
  if [ $actualSize -ge $minimumSize ]; then
      fileDiffs=$(cat $checksumFile | grep -e '<' -e '>' || echo 'all checksums match')
  else
      fileDiffs=$(echo $checksumFile is too small)
  fi
  
  echo $fileDiffs