Created
June 13, 2018 10:11
-
-
Save colin-nolan/66fbcaf787ef46dd4b89c101c6647636 to your computer and use it in GitHub Desktop.
Verifies content addressed blocks in S3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}/{}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To get more information about the failure, see: https://gist.github.com/colin-nolan/66fbcaf787ef46dd4b89c101c6647636.