Skip to content

Instantly share code, notes, and snippets.

@colin-nolan
Last active June 26, 2018 14:14
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/d1170b2ed0f66e9cb94e7b6e3ccf641d to your computer and use it in GitHub Desktop.
Save colin-nolan/d1170b2ed0f66e9cb94e7b6e3ccf641d to your computer and use it in GitHub Desktop.
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