-
-
Save gerard-kanters/f8f860b22189f46c7874 to your computer and use it in GitHub Desktop.
/etc/init.d/solr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script for running solr as a service under initd. | |
# | |
# Requires solr.conf and solr.start | |
# Usage: service solr {start|stop|restart|status}" | |
# | |
#----------------------------------------------------- | |
### BEGIN INIT INFO | |
# Provides: solr | |
# Required-Start: | |
# Required-Stop: | |
# Default-Start: 3 5 | |
# Default-Stop: 0 1 2 6 | |
### 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 | |
sleep 2 | |
;; | |
restart) | |
$0 stop | |
$0 start | |
;; | |
status) | |
status -p $PIDFILE solr | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|status}" | |
exit 3 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment