Class: Stf::Demonizer

Inherits:
Object
  • Object
show all
Defined in:
lib/stf/system/demonizer.rb

Instance Method Summary collapse

Constructor Details

#initialize(dante, opts = {}) ⇒ Demonizer

Returns a new instance of Demonizer.



3
4
5
6
7
8
# File 'lib/stf/system/demonizer.rb', line 3

def initialize(dante, opts = {})
  @dante = dante

  @pid_path = opts[:pid_path].to_s.empty? ? '/tmp/stf-client.pid' : opts[:pid_path]
  @log_path = opts[:log_path].to_s.empty? ? '/tmp/stf-client.log' : opts[:log_path]
end

Instance Method Details

#killObject



16
17
18
# File 'lib/stf/system/demonizer.rb', line 16

def kill
  @dante.execute(kill: true, pid_path: @pid_path)
end

#runObject



10
11
12
13
14
# File 'lib/stf/system/demonizer.rb', line 10

def run
  @dante.execute(daemonize: true,
                 pid_path: @pid_path,
                 log_path: @log_path) {yield}
end