Skip to content

Instantly share code, notes, and snippets.

@ixti
Created April 17, 2015 16:42
Show Gist options
  • Select an option

  • Save ixti/782c35aab496e3cd1e89 to your computer and use it in GitHub Desktop.

Select an option

Save ixti/782c35aab496e3cd1e89 to your computer and use it in GitHub Desktop.
#!/bin/sh
case "$1" in
3)
PATH="/home/ixti/.local/opt/mongodb-linux-x86_64-3.0.1/bin:$PATH"
MONGO_DB_PATH="/home/ixti/.local/var/mongodb-3"
echo "Starting MongoDB 3.0.1"
;;
"3wt")
PATH="/home/ixti/.local/opt/mongodb-linux-x86_64-3.0.1/bin:$PATH"
MONGO_DB_PATH="/home/ixti/.local/var/mongodb-3-wt"
MONGO_DB_OPTS="--storageEngine wiredTiger"
echo "Starting MongoDB 3.0.1 with WiredTiger engine"
;;
*)
PATH="/home/ixti/.local/opt/mongodb-2.4.2/bin:$PATH"
MONGO_DB_PATH="/home/ixti/.local/var/mongodb-2"
echo "Starting MongoDB 2.4.2"
;;
esac
MONGO_DB_DATA="${MONGO_DB_PATH}/data"
MONGO_DB_LOGFILE="${MONGO_DB_PATH}/mongodb.log"
pkill mongod
mkdir -p $MONGO_DB_PATH
mkdir -p $MONGO_DB_DATA
rm -f "$MONGO_DB_LOGFILE"
MONGOD_CMD="mongod --dbpath $MONGO_DB_DATA"
$MONGOD_CMD $MONGO_DB_OPTS --repair
$MONGOD_CMD $MONGO_DB_OPTS --logpath $MONGO_DB_LOGFILE --bind_ip 127.0.0.1 --nojournal --fork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment