Skip to content

Instantly share code, notes, and snippets.

@Hates
Created January 4, 2013 09:21
Show Gist options
  • Save Hates/4451166 to your computer and use it in GitHub Desktop.
Save Hates/4451166 to your computer and use it in GitHub Desktop.
Solr Monit
START_COMMAND="java -Dsolr.data.dir=/solr8983 -Djetty.port=8983
-DSTOP.PORT=8079 -DSTOP.KEY=solrprod -Xms512M -Xmx1024M -jar start.jar"
STOP_COMMAND="java -Dsolr.data.dir=/solr8983 -Djetty.port=8983
-DSTOP.PORT=8079 -DSTOP.KEY=solrprod -Xms512M -Xmx1024M -jar start.jar
--stop"
start() {
echo -n "Starting $NAME"
cd $SOLR_HOME
rm -f /solr8983/index/lucene-*-write.lock
$START_COMMAND 2> $LOG_FILE &
sleep 2
echo `ps -ef | grep -v grep | grep "$START_COMMAND" | awk '{print $2}'` >
$PIDFILE
echo "Done"
return 0
}
stop() {
echo -n "Stopping $NAME"
cd $SOLR_HOME
$STOP_COMMAND &
pkill -9 -f solr8983
rm -f $PIDFILE
echo "Done"
return 0
}
monit snippet:
check process solr.production with pidfile /solr8983/solr.production.pid
group search
if failed host localhost port 8983 then restart
start program = "/etc/init.d/solr.production start"
stop program = "/etc/init.d/solr.production stop"
if 5 restarts within 5 cycles then timeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment