Skip to content

Instantly share code, notes, and snippets.

@turboezh
Last active March 26, 2016 20:49
Show Gist options
  • Save turboezh/8285267 to your computer and use it in GitHub Desktop.
Save turboezh/8285267 to your computer and use it in GitHub Desktop.
Apache solr gentoo openrc init.d script
#!/sbin/runscript
NAME=solr
# customize path
SOLR_PATH=/opt/solr/example
COMMAND=java
OPTIONS="-Dsolr.solr.home=$SOLR_PATH/solr -Djetty.home=$SOLR_PATH -jar $SOLR_PATH/start.jar"
PIDFILE=/var/run/$NAME.pid
depend() {
#(Dependency information)
need net
}
start() {
#(Commands necessary to start the service)
#if [ "${RC_CMD}" = "restart" ];
#then
# Do something in case a restart requires more than stop, start
#fi
ebegin "Starting $NAME"
start-stop-daemon --start --background \
--name $NAME \
--chdir $SOLR_PATH \
--pidfile $PIDFILE \
--make-pidfile \
--exec $COMMAND -- $OPTIONS
eend $?
}
stop() {
#(Commands necessary to stop the service)
ebegin "Stopping $NAME"
start-stop-daemon --stop \
--name $NAME \
--pidfile $PIDFILE
eend $?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment