From 1ce6e3805fc07d29d23fc75641fd8cd51a13f5c2 Mon Sep 17 00:00:00 2001 From: Alexandre Barbosa Date: Thu, 19 Mar 2015 18:51:51 -0300 Subject: [PATCH] Insert Solr init.d files --- vagrant/misc/etc/init.d/solr | 45 +++++++++++++++++++++++++++++++++++++++++++++ vagrant/provision.sh | 12 +++++++++++- vagrant/solr/start.sh | 20 ++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100755 vagrant/misc/etc/init.d/solr create mode 100755 vagrant/solr/start.sh diff --git a/vagrant/misc/etc/init.d/solr b/vagrant/misc/etc/init.d/solr new file mode 100755 index 0000000..651af90 --- /dev/null +++ b/vagrant/misc/etc/init.d/solr @@ -0,0 +1,45 @@ +#!/bin/bash +# chkconfig: 2345 95 20 +# description: Solr +# processname: myscript +# +#----------------------------------------------------- +# Script for running solr as a service. +# +# Usage: service solr {start|stop|restart|status}" +# +#----------------------------------------------------- +# This should be placed in /etc/init.d + +. /etc/rc.d/init.d/functions + +# Path to pid file +PIDFILE=/var/run/solr.pid + +# Service name +NAME="Solr" + +# Service description +DESC="start/stop Solr Server" + +SOLR_INIT="/home/vagrant/solr-4.10.3/start.sh" + +case $1 in + start) + action "Starting ${NAME}: " daemon --pidfile $PIDFILE $SOLR_INIT + ;; + stop) + action "Stopping ${NAME}: " killproc -p $PIDFILE + ;; + restart) + $0 stop + $0 start + ;; + status) + status -p $PIDFILE solr + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 3 + ;; +esac diff --git a/vagrant/provision.sh b/vagrant/provision.sh index 2cda3ac..baaee83 100755 --- a/vagrant/provision.sh +++ b/vagrant/provision.sh @@ -39,6 +39,16 @@ colab-admin loaddata /vagrant/tests/test_data.json colab-admin build_solr_schema -f /tmp/schema.xml -SOLR_VERSION=4.10.3 SOLR_CONFS="/tmp/schema.xml" exec $basedir/ci/install_solr.sh +export SOLR_VERSION=4.10.3 +export SOLR_CONFS="/tmp/schema.xml" + +$basedir/ci/install_solr.sh +/home/vagrant/solr-4.10.3/bin/solr stop -p 8983 + +# Init.d Solr files +sudo cp $basedir/vagrant/misc/etc/init.d/solr /etc/init.d/ +cp $basedir/vagrant/solr/start.sh /home/vagrant/solr-$SOLR_VERSION +sudo chkconfig --add solr +sudo service solr start colab-admin rebuild_index --noinput diff --git a/vagrant/solr/start.sh b/vagrant/solr/start.sh new file mode 100755 index 0000000..5261d2d --- /dev/null +++ b/vagrant/solr/start.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Directory where solr is installed +SOLR_HOME=/home/vagrant/solr-4.10.3/example + +# Java options for Solr +OPTIONS="-Xmx1024m" + +# Path to pid file +PIDFILE=/var/run/solr.pid + +# Path to log file +LOG_FILE=/var/log/solr.log + +COMMAND="java $OPTIONS -jar start.jar" + +cd $SOLR_HOME +nohup $COMMAND > $LOG_FILE 2>&1 & +echo $! > $PIDFILE +exit $? -- libgit2 0.21.2