Add -f parameter to force check on disabled hosts
This commit is contained in:
parent
d138794924
commit
b2446abfd0
1 changed files with 6 additions and 3 deletions
|
@ -44,7 +44,7 @@ Getopt::Long::Configure('bundling');
|
|||
use lib "/usr/share/backuppc/lib";
|
||||
use BackupPC::Lib;
|
||||
|
||||
my $version = '1.1.2';
|
||||
my $version = '1.1.3';
|
||||
my $warnDaysOld = 2;
|
||||
my $critDaysOld = 7;
|
||||
my $verbose = 0;
|
||||
|
@ -54,6 +54,7 @@ my $goodOpt = 0;
|
|||
my @ownerOnly;
|
||||
my @hostsDesired;
|
||||
my @hostsExcluded;
|
||||
my $forceCheckOnDisabledHosts;
|
||||
my %Status;
|
||||
my $statusCode = 'OK';
|
||||
my $ok_count = 0;
|
||||
|
@ -71,7 +72,8 @@ $goodOpt = GetOptions(
|
|||
'V' => \$opt_V, 'version' => \$opt_V,
|
||||
'h' => \$opt_h, 'help' => \$opt_h,
|
||||
'H=s' => \@hostsDesired, 'hostname=s' => \@hostsDesired,
|
||||
'x=s' => \@hostsExcluded, 'exclude=s' => \@hostsExcluded);
|
||||
'x=s' => \@hostsExcluded, 'exclude=s' => \@hostsExcluded,
|
||||
'f' => \$forceCheckOnDisabledHosts, 'force=s' => \$forceCheckOnDisabledHosts);
|
||||
|
||||
@hostsDesired = () if $#hostsDesired < 0;
|
||||
@hostsExcluded = () if $#hostsExcluded < 0;
|
||||
|
@ -89,6 +91,7 @@ if ($opt_h or not $goodOpt)
|
|||
print " --hostname,-H only check the specified host\n";
|
||||
print " --exclude,-x do not check the specified host\n";
|
||||
print " --owner,-o do only hosts of specified user\n";
|
||||
print " --force,-f force check even if host is disabled\n";
|
||||
print " --warning,-w days old of last good backup to cause a warning\n";
|
||||
print " --critical,-c days old of last good backup to be critical\n";
|
||||
print " --verbose,-v increase verbosity\n";
|
||||
|
@ -148,7 +151,7 @@ foreach my $host (sort(keys(%Status)))
|
|||
next if (@ownerOnly and not grep {/$owner/} @ownerOnly);
|
||||
my %host_conf = %{$server->ConfigDataRead($host)};
|
||||
$Status{$host}{BackupsDisable} = $host_conf{BackupsDisable};
|
||||
next if ( $Status{$host}{BackupsDisable} );
|
||||
next if ( $Status{$host}{BackupsDisable} and not $forceCheckOnDisabledHosts);
|
||||
next if (@hostsDesired and not grep {/^$host$/} @hostsDesired);
|
||||
next if (@hostsExcluded and grep {/^$host$/} @hostsExcluded);
|
||||
next if ($Status{$host}{'type'} eq 'archive');
|
||||
|
|
Loading…
Reference in a new issue