-
-
Save mike-zhang/1a35b380bac510ad8795 to your computer and use it in GitHub Desktop.
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 | |
# | |
# 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
BigCouch启动脚本,可以配置bigcouch开机启动。
CentOS 6.4配置:
mv gistfile1.sh /etc/init.d/bigcouch
chmod a+x /etc/init.d/bigcouch
chkconfig bigcouch on