namespace :monit do %w(start stop restart).each do |task_name| desc "#{task_name} Monit" task task_name do on roles(:app), in: :sequence, wait: 5 do sudo "service monit #{task_name}" end end end desc "Reload Monit" task 'reload' do on roles(:app), in: :sequence, wait: 5 do sudo "monit reload" end end end