Skip to content

Instantly share code, notes, and snippets.

@bullfinch3000
Created November 4, 2011 15:40
Show Gist options
  • Save bullfinch3000/1339620 to your computer and use it in GitHub Desktop.
Save bullfinch3000/1339620 to your computer and use it in GitHub Desktop.
init.d script for Solr on Amazon Linux
#!/bin/sh -e
# Starts, stops, and restarts solr
SOLR_DIR=/usr/local/lib/solr/example
JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar"
LOG_FILE=/var/log/solr.log
JAVA=`which java`
case $1 in
start)
echo "Starting Solr"
cd $SOLR_DIR
$JAVA $JAVA_OPTIONS 2> $LOG_FILE &
;;
stop)
echo "Stopping Solr"
cd $SOLR_DIR
$JAVA $JAVA_OPTIONS --stop
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
@bullfinch3000
Copy link
Author

Simple script for starting and stopping Solr using /etc/init.d/solr

Requires a Solr build being available on /usr/local/lib/solr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment