Skip to content

Commit

Permalink
Merge pull request seuros#66 from zshannon/master
Browse files Browse the repository at this point in the history
bug fix for generator.
  • Loading branch information
seuros committed Feb 12, 2015
2 parents 77573c4 + 5f4c898 commit 5dff5a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 12 additions & 2 deletions lib/capistrano/tasks/monit.cap
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ namespace :sidekiq do
@role = role
template_sidekiq 'sidekiq_monit', "#{fetch(:tmp_dir)}/monit.conf", @role
sudo "mv #{fetch(:tmp_dir)}/monit.conf #{fetch(:sidekiq_monit_conf_dir)}/#{sidekiq_service_name}.conf"
sudo "#{fetch(:monit_bin)} reload"
end
end

desc 'Monitor Sidekiq monit-service'
task :monitor do
on roles(fetch(:sidekiq_role)) do
fetch(:sidekiq_processes).times do |idx|
sudo "#{fetch(:monit_bin)} monitor #{sidekiq_service_name(idx)}"
begin
sudo "#{fetch(:monit_bin)} monitor #{sidekiq_service_name(idx)}"
rescue
invoke 'sidekiq:monit:config'
sudo "#{fetch(:monit_bin)} monitor #{sidekiq_service_name(idx)}"
end
end
end
end
Expand All @@ -44,7 +50,11 @@ namespace :sidekiq do
task :unmonitor do
on roles(fetch(:sidekiq_role)) do
fetch(:sidekiq_processes).times do |idx|
sudo "#{fetch(:monit_bin)} unmonitor #{sidekiq_service_name(idx)}"
begin
sudo "#{fetch(:monit_bin)} unmonitor #{sidekiq_service_name(idx)}"
rescue
# no worries here
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
require 'rails/generators/base'

module Capistrano
module Sidekiq
module Monit
module Generators
class TemplateGenerator < Rails::Generators::Base

namespace "capistrano:sidekiq:monit:template"
desc "Create local monitrc.erb, and erb files for monitored processes for customization"
source_root File.expand_path('../templates', __FILE__)
argument :templates_path, type: :string,
Expand All @@ -18,4 +21,4 @@ def copy_template
end
end
end
end
end

0 comments on commit 5dff5a3

Please sign in to comment.