Sha256: 0033776e4f38ac5e22221dd3668f392f557495f86ddb1c342870e056d8aa4661

Contents?: true

Size: 1.95 KB

Versions: 18

Compression:

Stored size: 1.95 KB

Contents

namespace :deploy do
  namespace :monit do
    desc "Reloads monit service"
    task :reload do
      on roles :app do
        execute "sudo monit reload"
      end
    end

    desc "Starts applications"
    task :start do
      if ENV['DAEMONS'].present?
        on roles :app do
          ENV['DAEMONS'].split(',').each do |daemon|
            execute "sudo monit start #{fetch(:application)}-#{daemon}"
          end
        end
      else
        execute "sudo monit -g #{fetch(:application)} start all"
      end
    end

    desc "Stops applications"
    task :stop do
      if ENV['DAEMONS'].present?
        on roles :app do
          ENV['DAEMONS'].split(',').each do |daemon|
            execute "sudo monit stop #{fetch(:application)}-#{daemon}"
          end
        end
      else
        execute "sudo monit -g #{fetch(:application)} stop all"
      end
    end

    desc "Restarts applications"
    task :restart do
      if ENV['DAEMONS'].present?
        on roles :app do
          ENV['DAEMONS'].split(',').each do |daemon|
            execute "sudo monit restart #{fetch(:application)}-#{daemon}"
          end
        end
      else
        execute "sudo monit -g #{fetch(:application)} restart all"
      end
    end

    desc "Starts monitoring applications"
    task :monitor do
      if ENV['DAEMONS'].present?
        on roles :app do
          ENV['DAEMONS'].split(',').each do |daemon|
            execute "sudo monit monitor #{fetch(:application)}-#{daemon}"
          end
        end
      else
        execute "sudo monit -g #{fetch(:application)} monitor all"
      end
    end

    desc "Stops monitoring applications"
    task :unmonitor do
      if ENV['DAEMONS'].present?
        on roles :app do
          ENV['DAEMONS'].split(',').each do |daemon|
            execute "sudo monit unmonitor #{fetch(:application)}-#{daemon}"
          end
        end
      else
        execute "sudo monit -g #{fetch(:application)} unmonitor all"
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
capistrano-unformatt-1.11 lib/capistrano/tasks/monit.rake
capistrano-unformatt-1.10 lib/capistrano/tasks/monit.rake
capistrano-unformatt-1.9 lib/capistrano/tasks/monit.rake
capistrano-unformatt-1.8 lib/capistrano/tasks/monit.rake
capistrano-unformatt-1.7 lib/capistrano/tasks/monit.rake
capistrano-unformatt-1.6 lib/capistrano/tasks/monit.rake
capistrano-unformatt-1.5 lib/capistrano/tasks/monit.rake
capistrano-unformatt-1.4 lib/capistrano/tasks/monit.rake
capistrano-unformatt-1.3 lib/capistrano/tasks/monit.rake
capistrano-unformatt-1.1 lib/capistrano/tasks/monit.rake
capistrano-unformatt-1.0 lib/capistrano/tasks/monit.rake
capistrano-unformatt-0.7 lib/capistrano/tasks/monit.rake
capistrano-unformatt-0.6 lib/capistrano/tasks/monit.rake
capistrano-unformatt-0.5 lib/capistrano/tasks/monit.rake
capistrano-unformatt-0.4 lib/capistrano/tasks/monit.rake
capistrano-unformatt-0.3 lib/capistrano/tasks/monit.rake
capistrano-unformatt-0.2 lib/capistrano/tasks/monit.rake
capistrano-unformatt-0.1 lib/capistrano/tasks/monit.rake