Skip to content

Instantly share code, notes, and snippets.

@sbisbee
Created October 27, 2011 21:55
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sbisbee/1320996 to your computer and use it in GitHub Desktop.
init file for bigcouch on centos
#!/bin/bash
#
# chkconfig: 23 90 10
# Description: Quickly hacked together bigcouch init script for CentOS systems.
. /etc/init.d/functions
PID_FILE=/var/run/bigcouch.pid
BIGCOUCH_BIN=/opt/bigcouch/bin/bigcouch
SUBSYS_LOCK_FILE=/var/lock/subsys/bigcouch
export HOME=/tmp
start() {
echo -n "Starting bigcouch: "
if [ -f "$PID_FILE" ]; then
echo "already running: "`cat $PID_FILE`
exit 2
fi
$BIGCOUCH_BIN &>/dev/null &
echo $! > $PID_FILE
touch $SUBSYS_LOCK_FILE
echo "OK"
}
stop() {
echo -n "Shutting down bigcouch: "
if [ ! -f "$PID_FILE" ]; then
echo "already stopped"
else
kill -9 `cat $PID_FILE`
rm -f $PID_FILE
rm -f $SUBSYS_LOCK_FILE
echo "OK"
fi
}
status() {
if [ -f "$PID_FILE" ]; then
echo "Running with PID "`cat $PID_FILE`
else
echo "Not running"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: [start|stop|restart|status]"
exit 1
;;
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment