Last active
October 22, 2016 13:20
-
-
Save makuk66/e46b92111cf35cd4f49024a2215b2ed3 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# | |
# A helper script to initialise a custom SOLR_HOME. | |
# For example: | |
# | |
# mkdir mysolrhome | |
# sudo chown 8983:8983 mysolrhome | |
# docker run -it -v $PWD/mysolrhome:/mysolrhome -e SOLR_HOME=/mysolrhome solr | |
# | |
if [[ "$VERBOSE" = "yes" ]]; then | |
set -x | |
fi | |
# Normally SOLR_HOME is not set, and Solr will use /opt/solr/server/solr/ | |
# If it's not set, then this script has no relevance. | |
if [[ -z $SOLR_HOME ]]; then | |
exit | |
fi | |
# check the directory exists. | |
if [ ! -d "$SOLR_HOME" ]; then | |
echo "SOLR_HOME $SOLR_HOME does not exist" | |
exit 1 | |
fi | |
# don't do anything if it is non-empty | |
if [ $(find "$SOLR_HOME" -mindepth 1 | wc -l) != '0' ]; then | |
exit | |
fi | |
# populate with default solr home contents | |
echo "copying solr home contents to $SOLR_HOME" | |
cp -R /opt/solr/server/solr/* "$SOLR_HOME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment