Last active
June 26, 2018 14:14
-
-
Save colin-nolan/d1170b2ed0f66e9cb94e7b6e3ccf641d to your computer and use it in GitHub Desktop.
Classify verify failure type for https://gist.github.com/colin-nolan/66fbcaf787ef46dd4b89c101c6647636
This file contains 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
inputFile="$1" | |
function classifyFailure { | |
objectLocation="$1" | |
objectName="$(basename ${objectLocation})" | |
mc cat "${objectLocation}" &> /dev/null | |
if [[ $? -ne 0 ]]; then | |
echo "${objectLocation} = UNREADABLE" | |
else | |
mc cat "${objectLocation}" \ | |
| md5sum -c <(echo "${objectName} -") --status \ | |
&& echo "${objectLocation} = OK" \ | |
|| echo "${objectLocation} = CHECKSUM_FAIL" | |
fi | |
exit 0 | |
} | |
export -f classifyFailure | |
grep '= BAD' "${inputFile}" \ | |
| cut -d " " -f 1 \ | |
| parallel --no-notice classifyFailure {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment