check_backuppc: force check on disabled host if host is specified
This commit is contained in:
parent
9bed5546ee
commit
7fdfa4d41e
1 changed files with 5 additions and 2 deletions
|
@ -78,6 +78,9 @@ $goodOpt = GetOptions(
|
||||||
@hostsDesired = () if $#hostsDesired < 0;
|
@hostsDesired = () if $#hostsDesired < 0;
|
||||||
@hostsExcluded = () if $#hostsExcluded < 0;
|
@hostsExcluded = () if $#hostsExcluded < 0;
|
||||||
|
|
||||||
|
# Always check disabled host if a named host is provided (when backup is trigerred by cron)
|
||||||
|
$forceCheckOnDisabledHosts = 1 if ( @hostsDesired && scalar(@hostsDesired) );
|
||||||
|
|
||||||
if ($opt_V)
|
if ($opt_V)
|
||||||
{
|
{
|
||||||
print "check_backuppc - " . $version . "\n";
|
print "check_backuppc - " . $version . "\n";
|
||||||
|
@ -151,7 +154,7 @@ foreach my $host (sort(keys(%Status)))
|
||||||
next if (@ownerOnly and not grep {/$owner/} @ownerOnly);
|
next if (@ownerOnly and not grep {/$owner/} @ownerOnly);
|
||||||
my %host_conf = %{$server->ConfigDataRead($host)};
|
my %host_conf = %{$server->ConfigDataRead($host)};
|
||||||
$Status{$host}{BackupsDisable} = $host_conf{BackupsDisable};
|
$Status{$host}{BackupsDisable} = $host_conf{BackupsDisable};
|
||||||
next if ( $Status{$host}{BackupsDisable} eq 2 and not $forceCheckOnDisabledHosts);
|
next if ( $Status{$host}{BackupsDisable} && $Status{$host}{BackupsDisable} == 2 and not $forceCheckOnDisabledHosts );
|
||||||
next if (@hostsDesired and not grep {/^$host$/} @hostsDesired);
|
next if (@hostsDesired and not grep {/^$host$/} @hostsDesired);
|
||||||
next if (@hostsExcluded and grep {/^$host$/} @hostsExcluded);
|
next if (@hostsExcluded and grep {/^$host$/} @hostsExcluded);
|
||||||
next if ($Status{$host}{'type'} eq 'archive');
|
next if ($Status{$host}{'type'} eq 'archive');
|
||||||
|
@ -222,7 +225,7 @@ if ( $statusCode eq 'OK' ) {
|
||||||
foreach my $host ( keys %Status ) {
|
foreach my $host ( keys %Status ) {
|
||||||
next if (@hostsDesired and not grep {/^$host$/} @hostsDesired);
|
next if (@hostsDesired and not grep {/^$host$/} @hostsDesired);
|
||||||
next if (@hostsExcluded and grep {/^$host$/} @hostsExcluded);
|
next if (@hostsExcluded and grep {/^$host$/} @hostsExcluded);
|
||||||
next if ( $Status{$host}{BackupsDisable} );
|
next if ( $Status{$host}{BackupsDisable} && $Status{$host}{BackupsDisable} == 2 and not $forceCheckOnDisabledHosts );
|
||||||
next if ($Status{$host}{'type'} eq 'archive');
|
next if ($Status{$host}{'type'} eq 'archive');
|
||||||
if ( $Status{$host}{statusCode} && $Status{$host}{statusCode} ne 'OK' ) {
|
if ( $Status{$host}{statusCode} && $Status{$host}{statusCode} ne 'OK' ) {
|
||||||
$statusMsg .= ", " unless ( $first_host );
|
$statusMsg .= ", " unless ( $first_host );
|
||||||
|
|
Loading…
Reference in a new issue