Commit a2f96b46 by Andrew Babichev

Re-config sneakers monit service on fail

parent 4eec4195
......@@ -39,14 +39,23 @@ namespace :sneakers do
desc 'Monitor Sneakers monit-service'
task :monitor do
on roles(fetch(:sneakers_roles)) do
sudo_if_needed "#{fetch(:monit_bin)} monitor #{sneakers_service_name}"
begin
sudo_if_needed "#{fetch(:monit_bin)} monitor #{sneakers_service_name}"
rescue
invoke 'sneakers:monit:config'
sudo_if_needed "#{fetch(:monit_bin)} monitor #{sneakers_service_name}"
end
end
end
desc 'Unmonitor Sneakers monit-service'
task :unmonitor do
on roles(fetch(:sneakers_roles)) do
sudo_if_needed "#{fetch(:monit_bin)} unmonitor #{sneakers_service_name}"
begin
sudo_if_needed "#{fetch(:monit_bin)} unmonitor #{sneakers_service_name}"
rescue
# no worries here
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment