vendredi 8 mai 2015

Gem Daemons and Capistrano 3

I'm using gem - daemons. And have some misunderstanding :( How i can manage daemons after deploy? I need kill all daemons before deploy(before publish the new release) and start after finished. I have one idea:

namespace :deploy do
  desc 'Kill all existing daemons'
  task :kill_daemons do
    run( "cd #{deploy_to}/current; RAILS_ENV=production ruby lib/daemons/daemon1.rb stop" )
    run( "cd #{deploy_to}/current; RAILS_ENV=production ruby lib/daemons/daemon2.rb stop" )
  end

  after :started, :kill_daemons
  after :published, :start_daemons

  task :start_daemons do
    run( "cd #{deploy_to}/current; RAILS_ENV=production ruby lib/daemons/daemon1.rb start" )
    run( "cd #{deploy_to}/current; RAILS_ENV=production ruby lib/daemons/daemon1.rb start" )
  end
end

But how i can check the daemon is stopped?

Aucun commentaire:

Enregistrer un commentaire