RQ Bukhari
RQ Bukhari

Reputation: 167

Start sidekiq from a rake task

I'm trying to start Sidekiq by executing a rake task. Here is my code.

namespace :sidekiq do
  task start: :environment do
    system "bundle exec sidekiq -C 'Path To Config File' -P 'Path For PID File' -d -L 'Path To Log File'"
  end
end

When I run the rake task using the command

rake sidekiq:start

It starts sidekiq but rake task keeps waiting for response from Sidekiq. Any solution for this that my rake task doesn't wait for Sidekiq or it end when Sidekiq start.

Upvotes: 3

Views: 6264

Answers (1)

mcKain
mcKain

Reputation: 437

You should use foreman instead.

Add a Procfile file with your sidekiq line (something like):

worker: bundle exec sidekiq -C 'Path To Config File' -P 'Path For PID File' -d -L 'Path To Log File'

Also you might find useful this tutorial: http://blog.daviddollar.org/2011/05/06/introducing-foreman.html

Upvotes: 1

Related Questions