Implement timeout
This commit is contained in:
parent
d79a7d083c
commit
34ce8eb0bc
|
@ -4,7 +4,7 @@
|
||||||
"unknown"
|
"unknown"
|
||||||
],
|
],
|
||||||
"dynamic_config" : 0,
|
"dynamic_config" : 0,
|
||||||
"generated_by" : "Module::Build version 0.4224",
|
"generated_by" : "Module::Build version 0.4231",
|
||||||
"license" : [
|
"license" : [
|
||||||
"perl_5"
|
"perl_5"
|
||||||
],
|
],
|
||||||
|
@ -50,5 +50,5 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"version" : "0.002",
|
"version" : "0.002",
|
||||||
"x_serialization_backend" : "JSON::PP version 2.97001"
|
"x_serialization_backend" : "JSON::PP version 4.02"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ author:
|
||||||
- unknown
|
- unknown
|
||||||
build_requires: {}
|
build_requires: {}
|
||||||
dynamic_config: 0
|
dynamic_config: 0
|
||||||
generated_by: 'Module::Build version 0.4224, CPAN::Meta::Converter version 2.150010'
|
generated_by: 'Module::Build version 0.4231, CPAN::Meta::Converter version 2.150010'
|
||||||
license: perl
|
license: perl
|
||||||
meta-spec:
|
meta-spec:
|
||||||
url: http://module-build.sourceforge.net/META-spec-v1.4.html
|
url: http://module-build.sourceforge.net/META-spec-v1.4.html
|
||||||
|
|
|
@ -61,6 +61,7 @@ CREATE TABLE `filesets` (
|
||||||
`dir` text,
|
`dir` text,
|
||||||
`options` text,
|
`options` text,
|
||||||
active tinyint not null default 1,
|
active tinyint not null default 1,
|
||||||
|
timeout int,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
SET character_set_client = @saved_cs_client;
|
SET character_set_client = @saved_cs_client;
|
||||||
|
|
|
@ -12,7 +12,7 @@ This class represents one instance of a running collecting agent.
|
||||||
The only user-callable methods are the constructor new and the instance
|
The only user-callable methods are the constructor new and the instance
|
||||||
method run, which collects all the files from various disk agents.
|
method run, which collects all the files from various disk agents.
|
||||||
|
|
||||||
The Simba::CA package is a hashref with the following keys:
|
The Simba::CA object is a hashref with the following keys:
|
||||||
|
|
||||||
=over
|
=over
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ The Simba::CA package is a hashref with the following keys:
|
||||||
|
|
||||||
=item targets
|
=item targets
|
||||||
|
|
||||||
|
A list of entries (hashes) from table filesets.
|
||||||
|
|
||||||
=item ssh_id_file
|
=item ssh_id_file
|
||||||
|
|
||||||
=item target
|
=item target
|
||||||
|
@ -50,6 +52,10 @@ The Simba::CA package is a hashref with the following keys:
|
||||||
|
|
||||||
=item file_dfd
|
=item file_dfd
|
||||||
|
|
||||||
|
=item start_time
|
||||||
|
|
||||||
|
Timestamp when the backup of the current target started. Used to test when to abort due to timeout.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
@ -208,6 +214,7 @@ sub backup2disk {
|
||||||
|
|
||||||
$self->log(3, "starting backup for target host " . $target->{host} . " dir " . $target->{dir});
|
$self->log(3, "starting backup for target host " . $target->{host} . " dir " . $target->{dir});
|
||||||
$self->{target} = $target;
|
$self->{target} = $target;
|
||||||
|
$self->{start_time} = time();
|
||||||
|
|
||||||
# get previous generation
|
# get previous generation
|
||||||
$self->get_last_session();
|
$self->get_last_session();
|
||||||
|
@ -226,6 +233,15 @@ sub backup2disk {
|
||||||
close($list_cfd);
|
close($list_cfd);
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
while (<$list_dfd>) {
|
while (<$list_dfd>) {
|
||||||
|
if ($target->{timeout}) {
|
||||||
|
my $now = time();
|
||||||
|
my $elapsed = $now - $self->{start_time};
|
||||||
|
$self->log(10, "checking timeout " . $elapsed . " > " . $target->{timeout});
|
||||||
|
if ($elapsed > $target->{timeout}) {
|
||||||
|
$self->log(3, "Timeout exceeded. $elapsed > $target->{timeout}");
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
$count++;
|
$count++;
|
||||||
chomp;
|
chomp;
|
||||||
$self->log(10, "file: $_");
|
$self->log(10, "file: $_");
|
||||||
|
|
Loading…
Reference in New Issue