|
|
@ -2,7 +2,6 @@ |
|
|
|
use lib "/usr/share/BackupPC/lib"; |
|
|
|
use lib "/usr/share/BackupPC/lib"; |
|
|
|
use BackupPC::Lib; |
|
|
|
use BackupPC::Lib; |
|
|
|
use BackupPC::CGI::Lib; |
|
|
|
use BackupPC::CGI::Lib; |
|
|
|
use POSIX; |
|
|
|
|
|
|
|
use JSON; |
|
|
|
use JSON; |
|
|
|
|
|
|
|
|
|
|
|
# We need to switch to backuppc UID/GID |
|
|
|
# We need to switch to backuppc UID/GID |
|
|
@ -12,8 +11,10 @@ my (undef,undef,$bkpuid,$bkpgid) = getpwnam('backuppc'); |
|
|
|
setuid($bkpuid) if ($uid ne $bkpuid); |
|
|
|
setuid($bkpuid) if ($uid ne $bkpuid); |
|
|
|
setgid($bkpgid) if ($gid ne $bkpgid); |
|
|
|
setgid($bkpgid) if ($gid ne $bkpgid); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Precise the host to check |
|
|
|
my $host = $ARGV[0]; |
|
|
|
my $host = $ARGV[0]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get values |
|
|
|
my $bpc = BackupPC::Lib->new(); |
|
|
|
my $bpc = BackupPC::Lib->new(); |
|
|
|
my @backups = $bpc->BackupInfoRead($host); |
|
|
|
my @backups = $bpc->BackupInfoRead($host); |
|
|
|
my $mainConf = $bpc->ConfigDataRead(); |
|
|
|
my $mainConf = $bpc->ConfigDataRead(); |
|
|
@ -29,7 +30,9 @@ for ( my $i = 0 ; $i < @backups ; $i++ ) { |
|
|
|
$fullCnt++; |
|
|
|
$fullCnt++; |
|
|
|
if ( $fullAge < 0 || $backups[$i]{startTime} > $fullAge ) { |
|
|
|
if ( $fullAge < 0 || $backups[$i]{startTime} > $fullAge ) { |
|
|
|
$fullAge = $backups[$i]{startTime}; |
|
|
|
$fullAge = $backups[$i]{startTime}; |
|
|
|
$fullSize = $backups[$i]{size}; |
|
|
|
$fullSize0 = $backups[$i]{size}; |
|
|
|
|
|
|
|
$fullSize1 = $backups[$i]{size}; |
|
|
|
|
|
|
|
$fullSize2 = $backups[$i]{size}; |
|
|
|
$fullDur = $backups[$i]{endTime} - $backups[$i]{startTime}; |
|
|
|
$fullDur = $backups[$i]{endTime} - $backups[$i]{startTime}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -56,9 +59,14 @@ else { |
|
|
|
$lastXferErrors = $backups[@backups-1]{xferErrs} if ( @backups ); |
|
|
|
$lastXferErrors = $backups[@backups-1]{xferErrs} if ( @backups ); |
|
|
|
$maxErrors = $conf->{MaxXferError} if (defined $conf->{MaxXferError}); |
|
|
|
$maxErrors = $conf->{MaxXferError} if (defined $conf->{MaxXferError}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Print results |
|
|
|
print<<"EOF"; |
|
|
|
print<<"EOF"; |
|
|
|
|
|
|
|
Usage: $0 <host> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Size of last backup (0) : $fullSize0 |
|
|
|
|
|
|
|
Full Size of last -1 : $fullSize1 |
|
|
|
|
|
|
|
Full Size of last -2 : $fullSize2 |
|
|
|
|
|
|
|
|
|
|
|
Full Size of last backup : $fullSize |
|
|
|
|
|
|
|
EOF |
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
|
|
exit(0); |
|
|
|
exit(0); |
|
|
|