-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsolr.initd
58 lines (55 loc) · 1.62 KB
/
solr.initd
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
52
53
54
55
56
57
58
#!/bin/bash
#-----------------------------------------------------
# solr-initd v0.5.1
#-----------------------------------------------------
# Script for running solr as a service under initd.
#
# Requires solr.conf and solr.start
# Usage: service solr {start|stop|restart|status}"
#
# NOTE: This script was build specifically for Fedora,
# but also works on RHEL and CentOS. Other distributions
# are untest and probably require you to alter the scripts
#-----------------------------------------------------
# Author: Jeff Busby <jeff@jeffbusby.ca>
# License: http://creativecommons.org/licenses/by/3.0/
#-----------------------------------------------------
### BEGIN INIT INFO
# Provides: solr
# Required-Start:
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: init script for solr search
# Description: init script for solr search
# This should be placed in /etc/init.d
### END INIT INFO
if [ ! -e /etc/redhat-release ]; then
echo "This is built for RHEL/Fedora/CentOS, you may need to alter it to fit your distribution"
exit 1
fi
if [ ! -f /etc/solr.conf ]; then
echo "Missing config file /etc/solr.conf"
exit 1
fi
. /etc/rc.d/init.d/functions
. /etc/solr.conf
case $1 in
start)
action "Starting ${NAME}: " daemon --pidfile $PIDFILE $SOLR_START
;;
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