Class: RegenwolkeAutons::NginxAuton

Inherits:
Object
  • Object
show all
Includes:
StructureMapper::Hash
Defined in:
lib/regenwolke_autons/nginx_auton.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context.



14
15
16
# File 'lib/regenwolke_autons/nginx_auton.rb', line 14

def context
  @context
end

Instance Method Details

#startObject



16
17
18
19
# File 'lib/regenwolke_autons/nginx_auton.rb', line 16

def start
  context.schedule_step(:start_nginx_if_not_running)
  context.schedule_repeating_delayed_step 10, 10, :start_nginx_if_not_running
end

#start_nginxObject



21
22
23
24
25
26
27
28
# File 'lib/regenwolke_autons/nginx_auton.rb', line 21

def start_nginx
  create_config

  cp = ChildProcess.build('nginx', '-p', '.', '-c', 'nginx.config')
  cp.detach = true
  cp.start
  self.pid =  cp.pid
end

#start_nginx_if_not_runningObject



30
31
32
# File 'lib/regenwolke_autons/nginx_auton.rb', line 30

def start_nginx_if_not_running
  context.schedule_step(:start_nginx) unless nginx_process_exist?
end