Module: Kryten::Summoner

Defined in:
lib/kryten/summoner.rb

Instance Method Summary collapse

Instance Method Details

#daemonObject



37
38
39
40
41
42
43
# File 'lib/kryten/summoner.rb', line 37

def daemon
  raise 'Initialize daemon first with init_daemon' unless @daemon
  # run_proc with :multiple creates an application group (stack)
  # if there are multiple daemons with the same name,
  # the curent daemon is the last entry
  @daemon.applications.last
end

#init_daemonObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/kryten/summoner.rb', line 24

def init_daemon
  options = {
    log_output: false,
    backtrace: false,
    multiple: true,
    ARGV: ['start'],
    show_status_callback: :customstatus
  }

  @daemon = Daemons.run_proc(name, options) { start }

end

#pidObject



53
54
55
# File 'lib/kryten/summoner.rb', line 53

def pid
  daemon.pid.pid
end

#start_daemonObject



45
46
47
# File 'lib/kryten/summoner.rb', line 45

def start_daemon
  daemon.start
end

#statusObject



57
58
59
# File 'lib/kryten/summoner.rb', line 57

def status
  daemon.show_status
end

#stopObject



49
50
51
# File 'lib/kryten/summoner.rb', line 49

def stop
  daemon.stop
end