Created
July 12, 2010 15:30
-
-
Save jhsu/472592 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/sh | |
### BEGIN INIT INFO | |
# Provides: mongodb | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the mongodb data-store | |
# Description: starts mongodb using start-stop-daemon | |
### END INIT INFO | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/home/jshsu/bin/mongod | |
PIDFILE=/usr/local/mongodb/logs/mongodb.pid | |
LOGFILE=/usr/local/mongodb/logs/mongod.log | |
NAME=mongodb | |
DESC=mongodb | |
CONF=/etc/mongodb.conf | |
test -x $DAEMON || exit 0 | |
#set -e | |
start_daemon() { | |
if [ -f $CONF ]; then | |
start-stop-daemon --pidfile $PIDFILE --exec "$DAEMON" --start -- run --config $CONF >> $LOGFILE& | |
else | |
start-stop-daemon --pidfile $PIDFILE --exec "$DAEMON" --start -- run >> $LOGFILE& | |
fi | |
} | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
start_daemon | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
start-stop-daemon --quiet --pidfile $PIFDILE --exec $DAEMON --stop | |
echo "$NAME." | |
;; | |
restart|force-reload) | |
echo -n "Restarting $DESC: " | |
start-stop-daemon --quiet --pidfile $PIDFILE --exec $DAEMON --stop | |
sleep 1 | |
start_daemon | |
echo "$NAME." | |
;; | |
reload) | |
echo -n "Reloading $DESC configuration: " | |
start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --exec $DAEMON | |
echo "$NAME." | |
;; | |
*) | |
N=/etc/init.d/$NAME | |
echo "Usage: $N {start|stop|restart|force-reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
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
# Where the databases will be stored | |
dbpath=/data/mongodb/ | |
# The port number the mongod server will listen on | |
# port=27017 | |
# Listen on a specific ip address | |
# Comment out the line below if you need to access mongod remotely. | |
# USE WITH CAUTION -- THIS WILL ACCEPT ANY AND ALL CONNECTIONS WHEN USED WITH | |
# THE noauth OPTION!!! | |
bind_ip=127.0.0.1 | |
# Log location -- otherwise stdout | |
logpath=/usr/local/mongodb/logs/mongod.log | |
# appnd to logpath instead of over-writing | |
# logappend=true | |
# Use authentication | |
# auth=true | |
# Don't use authentication | |
noauth=true | |
# Disable the http interface | |
nohttpinterface=true | |
fork=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment