Skip to content

Instantly share code, notes, and snippets.

@christopherscott
Created June 2, 2012 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christopherscott/2856060 to your computer and use it in GitHub Desktop.
Save christopherscott/2856060 to your computer and use it in GitHub Desktop.
MongoDB start/stop Cakefile
{exec} = require 'child_process'
task "db:start", "start mongo db daemon process", ->
exec "mongod --fork --logpath ~/mongodb.log --logappend"
console.log "mongodb started"
task "db:stop", "stop mongo daemon process", ->
exec "kill -2 `ps -ef | grep 'mongod --fork' | grep -v grep | awk '{ print $2 }'`"
console.log "mongodb should be stopped"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment