Skip to content

Instantly share code, notes, and snippets.

@addisonj
Forked from codepunkt/rm-corrupt.sh
Last active December 23, 2015 05:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save addisonj/6586817 to your computer and use it in GitHub Desktop.
Save addisonj/6586817 to your computer and use it in GitHub Desktop.
Checks all the wsp files in a whisper storage and deletes any corrupt files
#!/bin/bash
matches=()
directory='/opt/graphite/storage/whisper'
for file in $(find $directory -type f -name '*.wsp' -print); do
$(python /usr/local/bin/whisper-info.py $file > /dev/null 2>&1)
retval=$?
echo "checking $file"
[ $retval -ne 0 ] && matches+=($file)
done
echo "deleting ${#matches[@]} corrupt files:"
for file in "${matches[@]}"; do
sudo rm $file && echo -e "- $file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment