Created
July 13, 2011 02:57
-
-
Save seratch/1079626 to your computer and use it in GitHub Desktop.
Apache Solr setup script
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/sh -x | |
# ------------------------ | |
# Configuration | |
BASE_URL=http://ftp.kddilabs.jp/infosystems/apache/lucene/solr | |
VERSION=3.3.0 | |
DEPLOY_DIR=/your/tomcatorlikethat/webapps | |
SOLR_WAR_NAME=solr | |
WORK_DIR=~/solr_update_work | |
BACKUP_DIR=~/solr_backup | |
# ------------------------ | |
# Backup current solr.war | |
mkdir -p ${BACKUP_DIR} | |
CURRENT_TIME=`date +%Y%m%d%H%M%S` | |
cp -p ${DEPLOY_DIR}/${SOLR_WAR_NAME}.war ${BACKUP_DIR}/${SOLR_WAR_NAME}.war.${CURRENT_TIME} | |
mkdir -p ${BACKUP_DIR}/${SOLR_WAR_NAME}.${CURRENT_TIME} | |
cp -pr ${DEPLOY_DIR}/${SOLR_WAR_NAME} ${BACKUP_DIR}/${SOLR_WAR_NAME}.${CURRENT_TIME} | |
# Downalod solr.war | |
rm -rf ${WORK_DIR} | |
mkdir -p ${WORK_DIR} | |
cd ${WORK_DIR} | |
wget ${BASE_URL}/${VERSION}/apache-solr-${VERSION}.tgz | |
tar xvfzp apache-solr-${VERSION}.tgz | |
cd ./apache-solr-${VERSION}/example/webapps | |
# Remove current solr.war | |
rm -rf ${DEPLOY_DIR}/${SOLR_WAR_NAME} | |
rm -f ${DEPLOY_DIR}/${SOLR_WAR_NAME}.war | |
# Copy new solr.war | |
cp -pr ./solr.war ${DEPLOY_DIR}/${SOLR_WAR_NAME}.war | |
mkdir -p ${DEPLOY_DIR}/${SOLR_WAR_NAME} | |
unzip solr.war -d ./solr | |
cp -pr ./solr/* ${DEPLOY_DIR}/${SOLR_WAR_NAME}/. | |
rm -rf ${WORK_DIR} | |
echo "Done." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment