def start_load
unless options[:ontop]
Daemonize.daemonize(output_logfile, @group.app_name)
else
Daemonize.simulate(output_logfile)
end
@pid.pid = Process.pid
at_exit do
begin; @pid.cleanup; rescue ::Exception; end
if options[:backtrace] && !options[:ontop] && !$daemons_sigterm
begin; exception_log; rescue ::Exception; end
end
end
$daemons_stop_proc = options[:stop_proc]
trap(SIGNAL) do
begin
if $daemons_stop_proc
$daemons_stop_proc.call
end
rescue ::Exception
end
begin; @pid.cleanup; rescue ::Exception; end
$daemons_sigterm = true
if options[:hard_exit]
exit!
else
exit
end
end
$DAEMONS_ARGV = @controller_argv
ENV['DAEMONS_ARGV'] = @controller_argv.join(' ')
ARGV.clear
ARGV.concat @app_argv if @app_argv
started
load script
end