X-Git-Url: http://git.indexdata.com/?p=lui-solr.git;a=blobdiff_plain;f=scripts%2Fzookeeper.sh;h=50491e45d21c8fc064fc779b35d8af2d226879a1;hp=49ba07306a41e370a7e4b8e9bb303ab4dcd14d6d;hb=dbd01a6924b459410829a2d16e13e3a147492276;hpb=ab565e092d2c9c67cff971cc93cf77407adefec4 diff --git a/scripts/zookeeper.sh b/scripts/zookeeper.sh index 49ba073..50491e4 100755 --- a/scripts/zookeeper.sh +++ b/scripts/zookeeper.sh @@ -1,4 +1,4 @@ -#/bin/bash +#!/bin/bash NAME="indexdata-lui-solr-zookeeper" HOST=localhost @@ -34,19 +34,28 @@ if [ "$SHARDS" == "" ] ; then fi if [ "$ZOOKEEPER" == "yes" ] ; then ZKRUN="-DzkRun -DnumShards=${SHARDS}" -fi -OPTIONS=" -Djetty.port=$PORT ${BOOTSTRAP_OPT} -Dcollection.configName=$NAME ${ZKRUN} -DzkHost=${ZKHOSTS} " +fi +if [ "${SOLR_HOME}" != "" ] ; then + SOLR_HOME_OPT="-Dsolr.solr.home=${SOLR_HOME}" +fi + +OPTIONS=" $SOLR_HOME_OPT -Djetty.port=$PORT ${BOOTSTRAP_OPT} -Dcollection.configName=$NAME ${ZKRUN} -DzkHost=${ZKHOSTS} " if [ "$1" == "start" ]; then if [ -f "${PID_FILE}" ] ; then echo "pid file ${PID_FILE} exists. Already running?" - exit 1 + else + java $OPTIONS -jar start.jar > $LOG_FILE & + echo $! > ${PID_FILE} fi - java $OPTIONS -jar start.jar > $LOG_FILE & - echo $! > ${PID_FILE} elif [ "$1" == "stop" ]; then if [ -f "${PID_FILE}" ] ; then - kill `cat ${PID_FILE}` - rm ${PID_FILE} + PID="`/bin/cat ${PID_FILE}`" + if [ "$PID" != "" ] ; then + kill $PID + /bin/rm ${PID_FILE} + else + echo "Unable to extract PID from ${PID_FILE}" + fi else echo "No pid file ($PID_FILE) found" fi