Skip to content

Instantly share code, notes, and snippets.

@mklymyshyn
Created September 2, 2011 08:03
Show Gist options
  • Save mklymyshyn/1188141 to your computer and use it in GitHub Desktop.
Save mklymyshyn/1188141 to your computer and use it in GitHub Desktop.
#!/bin/bash
OPTS=--rest
MONGO=/opt/local/bin/mongod
DBPATH=/opt/local/data/db
PIDFILE=/var/run/mongo.pid
IP=127.0.0.1
LOGS=/var/log/mongo.log
case $1 in
start)
echo "Starting Mongo..."
$MONGO --dbpath $DBPATH \
--pidfilepath $PIDFILE \
--bind_ip $IP \
$OPTS \
--logpath $LOGS &
;;
stop)
echo "Stopping Mongo..."
kill `cat $PIDFILE`
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 [start|stop|restart]"
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment