Skip to content

Commit

Permalink
Merge pull request #69 from bencrouse/master
Browse files Browse the repository at this point in the history
Try execute on the monit.conf mv command
  • Loading branch information
seuros committed Feb 27, 2015
2 parents 58c7bc3 + f9bb075 commit 6d16ad6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/capistrano/tasks/monit.cap
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ namespace :sidekiq do
on roles(fetch(:sidekiq_role)) do |role|
@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"

mv_command = "mv #{fetch(:tmp_dir)}/monit.conf #{fetch(:sidekiq_monit_conf_dir)}/#{sidekiq_service_name}.conf"

# Try execute in case the deploy user doesn't have sudo to mv
begin
execute mv_command
rescue
sudo mv_command
end

sudo "#{fetch(:monit_bin)} reload"
end
end
Expand Down

0 comments on commit 6d16ad6

Please sign in to comment.