Class: Smartguard::Applications::Smartkiosk::Sidekiq

Inherits:
Process
  • Object
show all
Defined in:
lib/smartguard/applications/smartkiosk/sidekiq.rb

Instance Attribute Summary

Attributes inherited from Process

#path, #pid

Instance Method Summary collapse

Methods inherited from Process

#active?, #initialize, #wanted?

Constructor Details

This class inherits a constructor from Smartguard::Process

Instance Method Details

#startObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/smartguard/applications/smartkiosk/sidekiq.rb', line 5

def start
  super

  Logging.logger.info "Starting sidekiq"

  config_path = @path.join('config/sidekiq.yml')
  log_path    = @path.join('log/sidekiq.log')
  pidfile     = @path.join('tmp/pids/sidekiq.pid')

  opts = []
  if Smartguard.environment == :production
    opts << "-L"
    opts << "#{log_path}"
  end

  FileUtils.rm_f pidfile
  if !run(@path,
          {},
          "bundle", "exec",
          "sidekiq", "-e", Smartguard.environment.to_s, "-r", "./config/boot.rb", "--config=#{config_path}", "--pidfile=#{pidfile}", *opts
         )
    return false
  end

  without_respawn do
    wait_for_file pidfile
  end
end

#stopObject



34
35
36
37
38
39
# File 'lib/smartguard/applications/smartkiosk/sidekiq.rb', line 34

def stop
  super

  Logging.logger.info "Stopping sidekiq"
  kill_and_wait :TERM, 60
end