Sha256: 43fd678d4e3e090eeb9062a5752c720060699300305ca5cd86ebfd57b76cf4b9
Contents?: true
Size: 1020 Bytes
Versions: 1
Compression:
Stored size: 1020 Bytes
Contents
require 'structure_mapper' require 'childprocess' module RegenwolkeAutons class NginxAuton include StructureMapper::Hash attribute pid: Fixnum attribute stdout: String attribute stderr: String attr_accessor :context def start context.schedule_step(:start_nginx) end def start_nginx create_config cp = ChildProcess.build('nginx', '-p', '.', '-c', 'nginx.config') cp.detach = true cp.start self.pid = cp.pid end def check_process context.schedule_step(:start_nginx) unless nginx_process_exist? end private def nginx_process_exist? begin Process.getpgid( pid ) true rescue Errno::ESRCH false end end def create_config applications={'regenwolke' => [3000]} erb = ERB.new File.read(File.expand_path('../nginx_config.erb', __FILE__)) File.write("nginx.config",erb.result(binding)) end end Nestene::Registry.register_auton(NginxAuton) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
regenwolke_autons-0.0.1 | lib/regenwolke_autons/nginx_auton.rb |