Last active
August 29, 2015 14:11
-
-
Save bejean/a2002d848a93a70887cf to your computer and use it in GitHub Desktop.
SolrCloud Opensuse init.d start script sample
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 | |
# | |
# Template LSB system startup script for example service/daemon FOO | |
# Copyright (C) 1995--2005 Kurt Garloff, SUSE / Novell Inc. | |
# | |
# This library is free software; you can redistribute it and/or modify it | |
# under the terms of the GNU Lesser General Public License as published by | |
# the Free Software Foundation; either version 2.1 of the License, or (at | |
# your option) any later version. | |
# | |
# This library is distributed in the hope that it will be useful, but | |
# WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
# Lesser General Public License for more details. | |
# | |
# You should have received a copy of the GNU Lesser General Public | |
# License along with this library; if not, write to the Free Software | |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, | |
# USA. | |
# | |
# /etc/init.d/FOO | |
# LSB compatible service control script; see http://www.linuxbase.org/spec/ | |
# Please send feedback to http://www.suse.de/feedback/ | |
# | |
# Note: This template uses functions rc_XXX defined in /etc/rc.status on | |
# UnitedLinux/SUSE/Novell based Linux distributions. However, it will work | |
# on other distributions as well, by using the LSB (Linux Standard Base) | |
# or RH functions or by open coding the needed functions. | |
# Read http://www.tldp.org/HOWTO/HighQuality-Apps-HOWTO/ if you prefer not | |
# to use this template. | |
# | |
# chkconfig: 35 99 00 | |
# description: solr daemon runs solr under jetty | |
# | |
### BEGIN INIT INFO | |
# Provides: solr | |
# Required-Start: $syslog | |
# Should-Start: | |
# Required-Stop: $syslog | |
# Should-Stop: | |
# Default-Start: 3 5 | |
# Default-Stop: 0 1 2 6 | |
# Short-Description: Solr daemon runs solr under jetty and will respawn after crash | |
# Description: Start Solr under Jetty y using scripts provided by solr distribution in bin directory | |
### END INIT INFO | |
# You will probably want to change only thisfollowing lines. | |
BASEDIR="/opt/solr" | |
USER="root" | |
PROG="solr" | |
CMD="bin/solr" | |
ZKHOSTS="zkserver1:2181,zkserver2:2181,zkserver2:2181 " | |
RETVAL=0 | |
start () { | |
echo -n $"Starting ${PROG}" | |
runuser ${USER} -c "cd ${BASEDIR} | |
${CMD} start -c -z "$ZKHOSTS" " | |
echo | |
} | |
stop () { | |
echo -n $"Stopping ${PROG}" | |
runuser ${USER} -c "cd ${BASEDIR} | |
${CMD} stop" | |
echo | |
} | |
restart () { | |
stop | |
start | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart}" | |
RETVAL=2 | |
;; | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment