Created
July 24, 2013 01:49
-
-
Save yantonov/6067550 to your computer and use it in GitHub Desktop.
mongod start script
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 | |
function start { | |
$MONGODB_HOME/bin/mongod --config=$MONGODB_HOME/bin/mongo.conf | |
} | |
case $1 in | |
start) | |
start | |
;; | |
daemon) | |
pid=`pidof mongod` | |
if [ -n "$pid" ]; then | |
echo "mongod already running" | |
else | |
nohup `start` > output.out 2>error.err </dev/null & | |
echo "`pidof mongod` mongod started" | |
fi | |
;; | |
stop) | |
pid=`pidof mongod` | |
if [ -n "$pid" ]; then | |
kill -9 $pid | |
echo "$pid mondod stopped" | |
else | |
echo "no mongod instances" | |
fi | |
;; | |
*) | |
echo "Usage: $0 {start|daemon|restart}" | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment