Created
August 16, 2010 18:30
-
-
Save infynyxx/527484 to your computer and use it in GitHub Desktop.
init.d script for MongoDB
This file contains hidden or 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
MONGO_OPTS="--quiet --pairwith 192.168.1.6 --arbiter 192.168.1.5" |
This file contains hidden or 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 | |
if [ -s /etc/default/mongodb ]; then | |
. /etc/default/mongodb | |
else | |
log_failure_msg "Could not find /etc/default/mongodb (aborting)" | |
exit 1 | |
fi | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/opt/mongodb/bin/mongod | |
PIDFILE=/data/db/mongod.lock | |
LOGFILE=/opt/mongodb/logs/mongod.log | |
NAME=mongodb | |
DESC=mongodb | |
test -x $DAEMON || exit 0 | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
#start-stop-daemon --make-pidfile --pidfile $PIDFILE --exec $DAEMON --start -- run >> $LOGFILE& | |
$DAEMON $MONGO_OPTS >> $LOGFILE& | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
#start-stop-daemon --quiet --pidfile $PIFDILE --exec $DAEMON --stop | |
#start-stop-daemon --quiet --pidfile /opt/mongodb/logs/mongodb.pid --exec /opt/mongodb/bin/mongod --stop | |
kill -1 `cat $PIDFILE` | |
rm $PIDFILE | |
echo "$NAME." | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment