default to /var/[log|run]
[lui-solr.git] / scripts / zookeeper.sh
index 8ff8bb4..8e48202 100755 (executable)
@@ -1,28 +1,27 @@
 #/bin/bash
 
-DIR=`dirname $0`
-PROG=`basename $0`
-
-cd $DIR
-OPTIONS="-Djetty.port=7500 -DzkHost=opencontent-solr.index:9983"
+OPTIONS="-Djetty.port=8983 -DzkHost=opencontent-solr.index:9983"
+NAME="indexdata-solr-zookeeper"
+PID_FILE=/var/run/${NAME}.pid
+LOG_FILE=/var/log/${NAME}.log
 if [ -f "options" ]; then 
     source options
 else
     echo "No options file. Using defaults: $OPTIONS"
 fi
 
-if [ "$1" = "start" ]; then 
-    if [ -f "${PROG}.pid" ] ; then 
-       echo "Pid file ${DIR}/${PROG}.pid exists. Already running?"
+if [ "$1" == "start" ]; then 
+    if [ -f "${PID_FILE}" ] ; then 
+       echo "pid file ${PID_FILE} exists. Already running?"
        exit 1
     fi
-    java $OPTIONS  -jar start.jar > solr.log & 
-    echo $$ > ${PROG}.pid
-elif [ "$1" = "stop" ]; then 
-    if [ -x "${PROG}.pid" ] ; then 
-       kill `echo ${PROG}.pid`
-       rm ${PROG}.pid
+    java $OPTIONS  -jar start.jar > $LOG_FILE & 
+    echo $! > ${PID_FILE}
+elif [ "$1" == "stop" ]; then 
+    if [ -x "${PID_FILE}" ] ; then 
+       kill `echo ${PID_FILE}`
+       rm ${PID_FILE}
     fi
 else
-       echo "$0 [start|stop]" 
+       echo "$0 [start|stop|status]" 
 fi