Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: b8a76320f6
Fetching contributors…

Cannot retrieve contributors at this time

executable file 62 lines (51 sloc) 1.561 kB
#!/bin/sh
#/ Usage: solr <path/to/solr_home> [-Djetty.host=localhost] [-Djetty.port=8983] [-Djetty.logs=/var/log/solr] [-Xmx1024m]
#/ Run the Solr enterprise search platform.
set -e
# show usage
[ "$1" = "--help" ] && {
grep '^#/'< "$0" |
cut -c4-
exit 2
}
if [ `id -u` -ne 0 ]; then
echo "Solr needs superuser privileges, abort."
exit 1
fi
# Load SOLR_USER, SOLR_LOGDIR, SOLR_HOST and SOLR_HOME from /etc/default/solr.
[ -r /etc/default/solr ] && . /etc/default/solr
SOLR_USER="${SOLR_USER:='nobody'}"
SOLR_LOGDIR="${SOLR_LOGDIR:='/var/log/solr'}"
SOLR_LOG_PROPERTIES="${SOLR_LOG_PROPERTIES:='/usr/share/solr/logging.properties'}"
SOLR_HOST="${SOLR_HOST:='localhost'}"
SOLR_PORT="${SOLR_PORT:='8983'}"
SOLR_JAVA_OPTS="${SOLR_JAVA_OPTS:=''}"
if [ -n "$1" ]; then
SOLR_HOME=$1
shift
fi
if [ -z "$SOLR_HOME" ]; then
echo "SOLR_HOME is not set, abort."
exit 1
fi
if [ ! -e "$SOLR_HOME/solr.xml" ]; then
echo "$SOLR_HOME/solr.xml is missing. Please bootstrap $SOLR_HOME. Abort."
exit 1
fi
JAVA_OPTS="
-Djetty.home=/usr/share/solr/jetty
-Djetty.logs=/var/log/solr/
-Djetty.host=$SOLR_HOST
-Djetty.port=$SOLR_PORT
-Djava.util.logging.config.file=$SOLR_LOG_PROPERTIES
-server
-Xms512m
-Xmx1024m
$SOLR_JAVA_OPTS
"
mkdir -p $SOLR_LOGDIR && chown -R $SOLR_USER $SOLR_LOGDIR
mkdir -p $SOLR_HOME/data && chown -R $SOLR_USER $SOLR_HOME/data
exec sudo -u $SOLR_USER java $JAVA_OPTS \
-Dsolr.solr.home=$SOLR_HOME "$@" \
-jar /usr/share/solr/jetty/start.jar \
/usr/share/solr/jetty/etc/jetty.xml >> $SOLR_LOGDIR/solr.log 2>&1
Jump to Line
Something went wrong with that request. Please try again.