-#/bin/bash
+#!/bin/bash
NAME="indexdata-lui-solr-zookeeper"
HOST=localhost
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