Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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 $?
@mike-zhang

This comment has been minimized.

Copy link
Owner Author

@mike-zhang mike-zhang commented Aug 20, 2014

BigCouch启动脚本,可以配置bigcouch开机启动。
CentOS 6.4配置:

mv gistfile1.sh /etc/init.d/bigcouch
chmod a+x /etc/init.d/bigcouch
chkconfig bigcouch on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment