Skip to content

Instantly share code, notes, and snippets.

@jasonmimick
Created March 7, 2018 21:11
Show Gist options
  • Save jasonmimick/7c21ab223397feb01c4fe49c37e4376e to your computer and use it in GitHub Desktop.
Save jasonmimick/7c21ab223397feb01c4fe49c37e4376e to your computer and use it in GitHub Desktop.
#!/bin/bash
dir=$(pwd)
dbpath="${dir}/mms-app-db"
lock="${dbpath}/mongodb.lock"
shell="${dir}/mongodb-linux*/bin/mongo"
# if lock stop
if [ ! -f ${lock} ]; then
echo "mongodb running, shutting down..."
${shell} admin --eval 'db.shutdownServer()'
sleep 2
fi
${dir}/mongodb-linux*/bin/mongod --dbpath=${dbpath} \
--logpath=${dbpath}/mongodb.log \
--wiredTigerCacheSizeGB=10 \
--fork
sleep 2
mongo_up=$(${shell} --eval 'db.serverStatus()')
echo "mongo_up=${mongo_up}"
${dir}/mongodb-mms*/bin/mongodb-mms start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment