Commit 1ce6e3805fc07d29d23fc75641fd8cd51a13f5c2
1 parent
f1d10ea7
Exists in
master
and in
39 other branches
Insert Solr init.d files
Stop current process and start a new process with Initd Signed-off-by: Alexandre Barbosa <alexandreab@live.com> Signed-off-by: Gustavo Jaruga <darksshades@gmail.com>
Showing
3 changed files
with
76 additions
and
1 deletions
Show diff stats
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +#!/bin/bash | ||
2 | +# chkconfig: 2345 95 20 | ||
3 | +# description: Solr | ||
4 | +# processname: myscript | ||
5 | +# | ||
6 | +#----------------------------------------------------- | ||
7 | +# Script for running solr as a service. | ||
8 | +# | ||
9 | +# Usage: service solr {start|stop|restart|status}" | ||
10 | +# | ||
11 | +#----------------------------------------------------- | ||
12 | +# This should be placed in /etc/init.d | ||
13 | + | ||
14 | +. /etc/rc.d/init.d/functions | ||
15 | + | ||
16 | +# Path to pid file | ||
17 | +PIDFILE=/var/run/solr.pid | ||
18 | + | ||
19 | +# Service name | ||
20 | +NAME="Solr" | ||
21 | + | ||
22 | +# Service description | ||
23 | +DESC="start/stop Solr Server" | ||
24 | + | ||
25 | +SOLR_INIT="/home/vagrant/solr-4.10.3/start.sh" | ||
26 | + | ||
27 | +case $1 in | ||
28 | + start) | ||
29 | + action "Starting ${NAME}: " daemon --pidfile $PIDFILE $SOLR_INIT | ||
30 | + ;; | ||
31 | + stop) | ||
32 | + action "Stopping ${NAME}: " killproc -p $PIDFILE | ||
33 | + ;; | ||
34 | + restart) | ||
35 | + $0 stop | ||
36 | + $0 start | ||
37 | + ;; | ||
38 | + status) | ||
39 | + status -p $PIDFILE solr | ||
40 | + ;; | ||
41 | + *) | ||
42 | + echo "Usage: $0 {start|stop|restart|status}" | ||
43 | + exit 3 | ||
44 | + ;; | ||
45 | +esac |
vagrant/provision.sh
@@ -39,6 +39,16 @@ colab-admin loaddata /vagrant/tests/test_data.json | @@ -39,6 +39,16 @@ colab-admin loaddata /vagrant/tests/test_data.json | ||
39 | 39 | ||
40 | colab-admin build_solr_schema -f /tmp/schema.xml | 40 | colab-admin build_solr_schema -f /tmp/schema.xml |
41 | 41 | ||
42 | -SOLR_VERSION=4.10.3 SOLR_CONFS="/tmp/schema.xml" exec $basedir/ci/install_solr.sh | 42 | +export SOLR_VERSION=4.10.3 |
43 | +export SOLR_CONFS="/tmp/schema.xml" | ||
44 | + | ||
45 | +$basedir/ci/install_solr.sh | ||
46 | +/home/vagrant/solr-4.10.3/bin/solr stop -p 8983 | ||
47 | + | ||
48 | +# Init.d Solr files | ||
49 | +sudo cp $basedir/vagrant/misc/etc/init.d/solr /etc/init.d/ | ||
50 | +cp $basedir/vagrant/solr/start.sh /home/vagrant/solr-$SOLR_VERSION | ||
51 | +sudo chkconfig --add solr | ||
52 | +sudo service solr start | ||
43 | 53 | ||
44 | colab-admin rebuild_index --noinput | 54 | colab-admin rebuild_index --noinput |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +#!/bin/bash | ||
2 | + | ||
3 | +# Directory where solr is installed | ||
4 | +SOLR_HOME=/home/vagrant/solr-4.10.3/example | ||
5 | + | ||
6 | +# Java options for Solr | ||
7 | +OPTIONS="-Xmx1024m" | ||
8 | + | ||
9 | +# Path to pid file | ||
10 | +PIDFILE=/var/run/solr.pid | ||
11 | + | ||
12 | +# Path to log file | ||
13 | +LOG_FILE=/var/log/solr.log | ||
14 | + | ||
15 | +COMMAND="java $OPTIONS -jar start.jar" | ||
16 | + | ||
17 | +cd $SOLR_HOME | ||
18 | +nohup $COMMAND > $LOG_FILE 2>&1 & | ||
19 | +echo $! > $PIDFILE | ||
20 | +exit $? |