lib/capistrano/tasks/sidekiq.rake in capistrano-sidekiq-1.0.2 vs lib/capistrano/tasks/sidekiq.rake in capistrano-sidekiq-1.0.3

- old
+ new

@@ -18,10 +18,11 @@ set :bundle_bins, fetch(:bundle_bins).to_a.concat(%w[sidekiq sidekiqctl]) # Init system integration set :init_system, -> { nil } # systemd integration set :service_unit_name, "sidekiq-#{fetch(:stage)}.service" + set :upstart_service_name, "sidekiq" end end namespace :deploy do before :starting, :check_sidekiq_hooks do @@ -42,10 +43,12 @@ on roles fetch(:sidekiq_roles) do |role| switch_user(role) do case fetch(:init_system) when :systemd execute :systemctl, "--user", "reload", fetch(:service_unit_name), raise_on_non_zero_exit: false + when :upstart + sudo :service, fetch(:upstart_service_name), :reload else if test("[ -d #{release_path} ]") each_process_with_index(reverse: true) do |pid_file, _idx| if pid_file_exists?(pid_file) && process_exists?(pid_file) quiet_sidekiq(pid_file) @@ -62,10 +65,12 @@ on roles fetch(:sidekiq_roles) do |role| switch_user(role) do case fetch(:init_system) when :systemd execute :systemctl, "--user", "stop", fetch(:service_unit_name) + when :upstart + sudo :service, fetch(:upstart_service_name), :stop else if test("[ -d #{release_path} ]") each_process_with_index(reverse: true) do |pid_file, _idx| if pid_file_exists?(pid_file) && process_exists?(pid_file) stop_sidekiq(pid_file) @@ -82,9 +87,11 @@ on roles fetch(:sidekiq_roles) do |role| switch_user(role) do case fetch(:init_system) when :systemd execute :systemctl, '--user', 'start', fetch(:service_unit_name) + when :upstart + sudo :service, fetch(:upstart_service_name), :start else each_process_with_index do |pid_file, idx| unless pid_file_exists?(pid_file) && process_exists?(pid_file) start_sidekiq(pid_file, idx) end