Class: ProxyMgr::Haproxy::Control

Inherits:
Object
  • Object
show all
Includes:
Callbacks
Defined in:
lib/proxymgr/haproxy/control.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Callbacks

#call

Constructor Details

#initialize(path, config_file) ⇒ Control

Returns a new instance of Control.



8
9
10
11
12
13
14
15
# File 'lib/proxymgr/haproxy/control.rb', line 8

def initialize(path, config_file)
  @path        = path
  @config_file = config_file

  @mutex       = Mutex.new

  callbacks :on_stop
end

Instance Attribute Details

#exit_codeObject (readonly)

Returns the value of attribute exit_code.



6
7
8
# File 'lib/proxymgr/haproxy/control.rb', line 6

def exit_code
  @exit_code
end

Instance Method Details

#restart(fds = []) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/proxymgr/haproxy/control.rb', line 21

def restart(fds = [])
  @mutex.synchronize do
    if @process
      run(@process.pid, fds)
    else
      run(nil, fds)
    end
  end
end

#startObject



17
18
19
# File 'lib/proxymgr/haproxy/control.rb', line 17

def start
  restart
end