Created
July 13, 2012 13:50
-
-
Save ygpark2/3104993 to your computer and use it in GitHub Desktop.
ubuntu solr init script for 4.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# Must be a valid filename | |
NAME=apache-solr | |
VERSION=4.0.0-ALPHA | |
APPNAME=joko | |
APPDIR=/home/jacob/$NAME-$VERSION/$APPNAME | |
#/var/run/app must be writable by your user | |
PIDFILE=/var/run/solr.pid | |
#This is the command to be run, give the full pathname | |
DAEMON="/usr/bin/java" | |
#create a config yml with daemonization options in it - and the same PIDFILE path as above | |
DAEMON_OPTS="-Dbootstrap_confdir=./solr/conf -Dcollection.configName=joko -DzkRun -DnumShards=2 -jar start.jar" | |
USER=www-data | |
LOGFILE=/var/log/solr/output.log | |
# below is our java opts, for a 8 gig ram, xeon quadcore machine, you might want to change this | |
# export JAVA_OPTS="-server -Xmx2500m -Xms2500m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:NewRatio=2 -XX:+DisableExplicitGC -Dhk2.file.directory.changeIntervalTimer=6000 -Xss2048k -XX:ParallelGCThreads=4 -XX:+AggressiveHeap" | |
# export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" | |
case "$1" in | |
start) | |
echo -n "Starting daemon: "$NAME | |
start-stop-daemon --background --start --chdir $APPDIR --quiet --chuid $USER --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS >> "$LOGFILE" | |
echo "." | |
;; | |
stop) | |
echo -n "Stopping daemon: "$NAME | |
start-stop-daemon --stop --chdir $APPDIR --quiet --chuid $USER --oknodo --pidfile $PIDFILE | |
echo "." | |
;; | |
restart) | |
echo -n "Restarting daemon: "$NAME | |
start-stop-daemon --stop --chdir $APPDIR --quiet --chuid $USER --oknodo --pidfile $PIDFILE | |
start-stop-daemon --background --start --chdir $APPDIR --quiet --chuid $USER --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS >> "$LOGFILE" | |
echo "." | |
;; | |
*) | |
echo "Usage: "$1" {start|stop|restart}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment