|
|
|
@ -194,9 +194,10 @@ sub new |
|
|
|
|
$anvil->data->{ENV_VALUES}{START_TIME} = Time::HiRes::time; |
|
|
|
|
|
|
|
|
|
# Set passed parameters if needed. |
|
|
|
|
my $debug = 3; |
|
|
|
|
my $debug = 2; |
|
|
|
|
my $on_sig_int; |
|
|
|
|
my $on_sig_term; |
|
|
|
|
my $on_sig_alarm; |
|
|
|
|
if (ref($parameter) eq "HASH") |
|
|
|
|
{ |
|
|
|
|
# Local parameters... |
|
|
|
@ -215,6 +216,7 @@ sub new |
|
|
|
|
|
|
|
|
|
$on_sig_int = $parameter->{on_sig_int}; |
|
|
|
|
$on_sig_term = $parameter->{on_sig_term}; |
|
|
|
|
$on_sig_alarm = $parameter->{on_sig_alarm}; |
|
|
|
|
} |
|
|
|
|
elsif ($parameter) |
|
|
|
|
{ |
|
|
|
@ -234,6 +236,11 @@ sub new |
|
|
|
|
|
|
|
|
|
$anvil->catch_sig({signal => "TERM"}); |
|
|
|
|
}; |
|
|
|
|
$SIG{ALARM} = sub { |
|
|
|
|
$on_sig_term->({ debug => $debug }) if (ref($on_sig_alarm) eq "CODE"); |
|
|
|
|
|
|
|
|
|
$anvil->catch_sig({signal => "ALARM"}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
# This sets the environment this program is running in. |
|
|
|
|
if ($ENV{SERVER_NAME}) |
|
|
|
|