Class: Mutx::BackgroundJobs::Sidekiq
- Inherits:
-
Object
- Object
- Mutx::BackgroundJobs::Sidekiq
- Defined in:
- lib/mutx/background_jobs/sidekiq.rb
Class Method Summary collapse
- .start ⇒ Object
-
.started? ⇒ Boolean
Existance of pid file means that sidekiq was started.
Class Method Details
.start ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mutx/background_jobs/sidekiq.rb', line 5 def self.start workers_dir = workers_dir = __FILE__.split("/")[0..-2].join("/")+ "/workers" #Mutx::Support::Console.execute "sidekiq -r #{workers_dir}/executor.rb -d -L mutx/logs/sidekiq.log -P mutx/sidekiq_pid" Mutx::Support::Console.execute "sidekiq -r #{workers_dir}/mutx_cron.rb -d -L mutx/logs/sidekiq.log -P mutx/sidekiq_cron_pid" #Mutx::Support::Console.execute "sidekiq -r #{workers_dir}/update_started.rb -d -L mutx/logs/sidekiq.log -P mutx/sidekiq_update_started_pid" print "\n* Sidekiq:" raise "Could not start Sidekiq correctly. Read mutx/logs/sidekiq.log file for more information" if not started? print " Started!\n" end |
.started? ⇒ Boolean
Existance of pid file means that sidekiq was started
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/mutx/background_jobs/sidekiq.rb', line 20 def self.started? begin sec = 0 begin print "." return true if IO.read("#{Dir.pwd}/mutx/logs/sidekiq.log") =~ /INFO: Booting Sidekiq \d+.\d+.\d+ with redis options {/ sec += sleep 1 end until sec == 10 puts "Sidekiq not started" false rescue false end end |