Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2496 from ec-europa/ISAICP-6544
Browse files Browse the repository at this point in the history
ISAICP-6544: Fix the restore_solr.sh script
  • Loading branch information
pfrenssen authored Jun 10, 2021
2 parents b739a41 + b05c854 commit 75e3c6c
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions scripts/solr/restore_solr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# and UAT environments. For local development better use the runner command:
# $ ./vendor/bin/run toolkit:install-dump

CURRENT_DIR=$(pwd)
SOLR_SERVER_URL="http://localhost:8983/solr"
TIMEOUT=300
TIMEOUT_PATTERN='^[0-9]+$'
Expand Down Expand Up @@ -56,13 +57,30 @@ if ! [[ $TIMEOUT =~ ${TIMEOUT_PATTERN} ]] ; then
error "Timeout needs to be numeric!";
fi

if [ "${CORE}" == '' ] || [ "${SNAPSHOT_DIR}" == '' ] || [ "${SNAPSHOT_NAME}" == '' ]; then
if [ "${CORE}" == '' ] || [ "${SNAPSHOT_NAME}" == '' ]; then
show_help;
exit 1;
fi

CORE_EXISTS=`curl -sS "${SOLR_SERVER_URL}/admin/cores?action=STATUS&core=${CORE}&wt=xml" |grep -o '<long name="uptime">'`
# Assume the current dir if no snapshot dir has been passed.
if [ "${SNAPSHOT_DIR}" == '' ]; then
SNAPSHOT_DIR=${CURRENT_DIR}
fi

if [ ! -d "${SNAPSHOT_DIR}" ]; then
error "The '${SNAPSHOT_DIR}' directory doesn't exist!";
fi

# Normalize the snapshot dir to an absolute path.
cd ${SNAPSHOT_DIR}
SNAPSHOT_DIR=$(pwd)
cd ${CURRENT_DIR}

if [ ! -d "${SNAPSHOT_DIR}/snapshot.${SNAPSHOT_NAME}" ]; then
error "The '${SNAPSHOT_DIR}' directory doesn't contain a '${SNAPSHOT_NAME}' snapshot!";
fi

CORE_EXISTS=`curl -sS "${SOLR_SERVER_URL}/admin/cores?action=STATUS&core=${CORE}&wt=xml" |grep -o '<long name="uptime">'`
if [ "${CORE_EXISTS}" == '' ]; then
error "Solr '${CORE}' core does not exists on this server!";
fi
Expand Down

0 comments on commit 75e3c6c

Please sign in to comment.