mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 01:22:36 +08:00
fc05164667
minor refinements to demon
26 lines
390 B
Ruby
26 lines
390 B
Ruby
require File.expand_path("../../../config/environment", __FILE__)
|
|
|
|
puts "Parent is now loaded"
|
|
|
|
class ForkExecDemon < Demon::Base
|
|
def self.prefix
|
|
"fork-exec-child"
|
|
end
|
|
|
|
def run
|
|
if @pid = fork
|
|
write_pid_file
|
|
return
|
|
end
|
|
|
|
exec "./child #{parent_pid}"
|
|
end
|
|
end
|
|
|
|
ForkExecDemon.start(1, verbose: true)
|
|
|
|
while true
|
|
ForkExecDemon.ensure_running
|
|
sleep 0.1
|
|
end
|