Created
January 24, 2013 13:54
-
-
Save 4np/4621850 to your computer and use it in GitHub Desktop.
two aliasses (mongostart and mongostop) to stop and start a mongoDB NOSQL store, installed using MacPorts
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
# mongo db | |
# see http://noteit.jiaeil.com/install-mongodb-via-macports-on-mac | |
alias mongostart="sudo nice mongod --rest -f /opt/local/etc/mongodb/mongod.conf; clear; tail -f /opt/local/var/log/mongodb/mongodb.log" | |
mongostop_func () { | |
# local mongopid=`ps -o pid,command -ax | grep mongod | awk '!/awk/ && !/grep/{print $1}'`; | |
# just find a simpler way | |
local mongopid=`less /opt/local/var/db/mongodb_data/mongod.lock`; | |
if [[ $mongopid =~ [[:digit:]] ]]; then | |
sudo kill -15 $mongopid; | |
echo mongod process $mongopid terminated; | |
else | |
echo mongo process $mongopid not exist; | |
fi | |
} | |
alias mongostop="mongostop_func" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment