Created
August 16, 2013 15:53
-
-
Save craigminihan/6251087 to your computer and use it in GitHub Desktop.
This is a VERY simple script to run couchdb-lucene as a daemon on CentOS 6.x. * Download and rename as couchdb-lucene and place in: /etc/rc.d/init.d
* Make it executable: chmod 755 /etc/rc.d/init.d/couchdb-lucene
* Add it as a daemon: chkconfig --add couchdb-lucene
* Start it: service couchdb-lucene start
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/sh | |
# | |
# This is a VERY simple script to run couchdb-lucene as a daemon on CentOS 6.x | |
# It is assumed that Java is installed and that couchdb-lucene is present on /usr/local | |
# | |
### BEGIN INIT INFO | |
# Provides: couchdb-lucene | |
# Short-Description: Starts couchdb-lucene as a daemon | |
# Description: Starts couchdb-lucene as a daemon | |
### END INIT INFO | |
# chkconfig: 235 98 98 | |
# load the init functions we need | |
. /etc/init.d/functions | |
VERSION=0.9.0 | |
DAEMON=/usr/local/couchdb-lucene-$VERSION/bin/run | |
LOCKFILE=/var/lock/subsys/couchdb-lucene | |
# if the 'run' script file sees a PIDFILE variable then it will run like a daemon, so we need to export this var | |
export PIDFILE=/var/run/couchdb-lucene.pid | |
start() { | |
daemon --pidfile $PIDFILE $DAEMON | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && touch $LOCKFILE | |
echo | |
return $RETVAL | |
} | |
stop() { | |
killproc -p $PIDFILE $DAEMON | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE && rm -f $PIDFILE | |
echo | |
return $RETVAL | |
} | |
restart() { | |
stop | |
start | |
} | |
RETVAL=0 | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status -p $PIDFILE couchdb-lucene | |
;; | |
restart|reload) | |
restart | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|status|restart|reload}" | |
exit 2 | |
esac | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same script for
Debian
based systems: