updated on Sat Jan 14 00:11:12 UTC 2012
[aur-mirror.git] / solr3-svn / solr.rc
bloba21d24bcb4d552ff3e74c746818622b94d6375fd
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 SOLR_DIR=/usr/share/java/solr
7 [ -f /etc/conf.d/solr ] && . /etc/conf.d/solr
9 PID=$(ps aux | grep 'java -jar start.jar' | grep -v grep | awk '{print $2}')
10 case "$1" in
11 start)
12 cd $SOLR_DIR
13 stat_busy "Starting Solr Daemon"
14 if [ -z "$PID" ]; then
15 java -jar start.jar 2> /var/log/solr.log &
17 if [ ! -z "$PID" -o $? -gt 0 ]; then
18 stat_fail
19 else
20 PID=$(ps aux | grep 'java -jar start.jar' | grep -v grep | awk '{print $2}')
21 echo $PID > /var/run/solr.pid
22 add_daemon solr
23 stat_done
26 stop)
27 stat_busy "Stopping Solr Daemon"
28 [ ! -z "$PID" ] && kill $PID &> /dev/null
29 if [ $? -gt 0 ]; then
30 stat_fail
31 else
32 rm_daemon solr
33 stat_done
36 status)
37 if [ -z $PID ]; then
38 echo "Solr service is down"
39 exit 1
40 else
41 echo "Solr Service is Running"
44 restart)
45 $0 stop
46 sleep 1
47 $0 start
50 echo "usage: $0 {start|stop|restart}"
51 esac