Created
October 23, 2012 16:15
-
-
Save justintime/3939788 to your computer and use it in GitHub Desktop.
Cleanup data directories for cores no longer served up by Solr
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
#!/bin/bash | |
# | |
SOLR_HOME="/srv/tomcat/rpsolr/solr" | |
for INDEX_DIR in `/bin/find ${SOLR_HOME} -type d -name index -exec dirname {} \;`; do | |
CORE=`/bin/basename ${INDEX_DIR}` | |
/bin/grep "<core name=\"${CORE}\"" ${SOLR_HOME}/solr.xml > /dev/null | |
if [ $? != 0 ]; then | |
echo "Removing datadir for non-existent core ${CORE}" | |
/bin/rm -rf ${SOLR_HOME}/${CORE} | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment