-
Notifications
You must be signed in to change notification settings - Fork 1
/
solr.rc
executable file
·51 lines (48 loc) · 1.02 KB
/
solr.rc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
SOLR_DIR=/usr/share/java/solr
[ -f /etc/conf.d/solr ] && . /etc/conf.d/solr
PID=$(ps aux | grep 'java -jar start.jar' | grep -v grep | awk '{print $2}')
case "$1" in
start)
cd $SOLR_DIR
stat_busy "Starting Solr Daemon"
if [ -z "$PID" ]; then
java -jar start.jar 2> /var/log/solr.log &
fi
if [ ! -z "$PID" -o $? -gt 0 ]; then
stat_fail
else
PID=$(ps aux | grep 'java -jar start.jar' | grep -v grep | awk '{print $2}')
echo $PID > /var/run/solr.pid
add_daemon solr
stat_done
fi
;;
stop)
stat_busy "Stopping Solr Daemon"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon solr
stat_done
fi
;;
status)
if [ -z $PID ]; then
echo "Solr service is down"
exit 1
else
echo "Solr Service is Running"
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac