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.5.3 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.5.2 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.5.1 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.5.0 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.14 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.13 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.12 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.11 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.10 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.9 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.8 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.6 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.5 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.4 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.3 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.2 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.1 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.4.0 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.3.39.3 lib/cap_recipes/tasks/mongodb/manage.rb
crazycode-cap-recipes-0.3.39.2 lib/cap_recipes/tasks/mongodb/manage.rb