def start_proc
return unless p = options[:proc]
myproc = proc do
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
p.call
end
unless options[:ontop]
@pid.pid = Daemonize.call_as_daemon(myproc, output_logfile, @group.app_name)
else
Daemonize.simulate(output_logfile)
myproc.call
end
started
end