Skip to content

Instantly share code, notes, and snippets.

@colin-nolan
Created June 13, 2018 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colin-nolan/66fbcaf787ef46dd4b89c101c6647636 to your computer and use it in GitHub Desktop.
Save colin-nolan/66fbcaf787ef46dd4b89c101c6647636 to your computer and use it in GitHub Desktop.
Verifies content addressed blocks in S3
s3Location="$1"
function verifyMd5 {
objectLocation="$1"
objectName="$(basename ${objectLocation})"
mc cat "${objectLocation}" \
| md5sum -c <(echo "${objectName} -") --status \
&& echo "${objectLocation} = OK" \
|| echo "${objectLocation} = BAD"
exit 0
}
export -f verifyMd5
mc ls --json "${s3Location}" \
| jq -r 'select(.type=="file") | .key' \
| parallel verifyMd5 "${s3Location}/{}"
@colin-nolan
Copy link
Author

To get more information about the failure, see: https://gist.github.com/colin-nolan/66fbcaf787ef46dd4b89c101c6647636.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment