Sha256: b3e87d128faa8a437ad74813b68628ba2ea4609503a44065e0ddb3c1ad98815e

Contents?: true

Size: 920 Bytes

Versions: 26

Compression:

Stored size: 920 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../utilities')
require File.expand_path(File.dirname(__FILE__) + '/install')

Capistrano::Configuration.instance(true).load do
  set :mongodb_log, "/var/log/mongodb.log"

  namespace :mongodb do
    desc "Starts the mongodb server"
    task :start, :role => :app do
      sudo "#{mongodb_bin_path}/bin/mongod --fork --logpath #{mongodb_log} --logappend --dbpath #{mongodb_data_path}"
    end

    desc "Stop the mongodb server"
    task :stop, :role => :app do
      pid = capture("ps -o pid,command ax | grep mongod | awk '!/awk/ && !/grep/ {print $1}'")
      sudo "kill -2 #{pid}" unless pid.strip.empty?
    end

    desc "Restart the mongodb server"
    task :restart, :role => :app do
      pid = capture("ps -o pid,command ax | grep mongod | awk '!/awk/ && !/grep/ {print $1}'")
      mongodb.stop unless pid.strip.empty?
      mongodb.start
    end

  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
crazycode-cap-recipes-0.3.39.1 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.3.39 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.3.38 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.3.37 lib/cap_recipes/tasks/mongodb/manage.rb
cap-recipes-0.3.36 lib/cap_recipes/tasks/mongodb/manage.rb
cap-recipes-0.3.35 lib/cap_recipes/tasks/mongodb/manage.rb