Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. if [ "$1" = "etc" ]; then
  2.     rsync ${RSYNCOPTS} "${srcetc}" "${buetc}"
  3.     if [ "$2" = "verify" ]; then
  4.         echo "Überprüfe Backup - bitte warten"
  5.        
  6.         temp_file="$(mktemp)"
  7.        
  8.         ### create hashes for files in source
  9.         pushd "${srcetc}"      
  10.         find -H ./ -xdev -type f -exec md5sum -b -- '{}' '+' 1>"${temp_file}" 2>'/dev/null'
  11.         popd
  12.        
  13.         ### compare to hashes in destination
  14.         pushd "${buetc}"
  15.         if md5sum -c "${temp_file}"; then
  16.             rm -- "${temp_file}"
  17.         else
  18.             echo "Retaining checksum file \"${temp_file}\"."
  19.         fi
  20.         popd
  21.     fi
  22. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement