Skip to content

Instantly share code, notes, and snippets.

@racke
Created December 29, 2013 12:03
Show Gist options
  • Save racke/8169718 to your computer and use it in GitHub Desktop.
Save racke/8169718 to your computer and use it in GitHub Desktop.
Simple Solr startup wrapper
#! /bin/bash
#
# Very basic init script for usage with eShop.
#
# Copyright 2013 Stefan Hornburg (Racke) <[email protected]>.
SOLR_HOME="$HOME/solr/example"
SOLR_LOGFILE=$(readlink -f ../../logs/solr.log)
SOLR_PIDFILE=$(readlink -f ../../run/solr.pid)
COMMAND="java $SOLR_OPTIONS -jar start.jar"
cd $SOLR_HOME
start() {
nohup $COMMAND > $SOLR_LOGFILE 2>&1 &
echo $! > $SOLR_PIDFILE
return $?
}
stop() {
/sbin/start-stop-daemon --stop --oknodo --pidfile $SOLR_PIDFILE
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment