Skip to content

Instantly share code, notes, and snippets.

@robdbirch
Created May 19, 2013 19:36
Show Gist options
  • Save robdbirch/5608704 to your computer and use it in GitHub Desktop.
Save robdbirch/5608704 to your computer and use it in GitHub Desktop.
God Mongo Shutdown function
def m_shutdown()
m = <<-mongo_shutdown
/usr/local/bin/mongo<<-md
use admin
db.shutdownServer()
exit
md
mongo_shutdown
end
God.watch do |w|
w.group = "middleware"
w.name = "mongo"
w.start = "/usr/local/bin/mongod --config #{APP_ROOT}/config/mongod.conf"
w.stop = m_shutdown
w.start_grace = 5.seconds
w.restart_grace = 5.seconds
w.log = "/usr/local/var/log/mongodb/mongo.log"
w.pid_file = "#{APP_ROOT}/run/mongo.pid"
w.keepalive
w.behavior(:clean_pid_file)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment