Skip to content

Instantly share code, notes, and snippets.

@wbzyl
Created January 23, 2012 11:32
Show Gist options
  • Save wbzyl/1662651 to your computer and use it in GitHub Desktop.
Save wbzyl/1662651 to your computer and use it in GitHub Desktop.
MongoDB
#! /bin/bash
function usageexit() {
echo "Usage: $(basename $0) [PORT] [other mongodb options]" >&2
exit 1
}
dbpath=$HOME/.data/var/lib/mongodb
config_file=$HOME/.data/etc/mongodb.conf
if [ ! -e $config_file ]
then
usageexit
fi
if [ $# -eq 1 ]; then
port=$1
shift
fi
: ${port:=27017}
echo "---- MongoDB config file:"
cat $config_file
echo "--------------------------"
mongod --config $config_file --dbpath $dbpath --port $port "$@"
journal=true # requires approx. 0.5 GB on disk
rest=true
cpu=true
directoryperdb=true
jsonp=true
nssize=2
smallfiles=true
objcheck=true
syncdelay=4
logpath=/home/wbzyl/.data/var/log/mongodb/mongo.log
pidfilepath=/home/wbzyl/.data/var/run/mongodb.pid
# bind_ip=0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment