NAME
BackupPC::Backups::Info - Restrieves info on BackupPC backups.
VERSION
Version 0.1.1
SYNOPSIS
Quick summary of what the module does.
Perhaps a little code snippet.
use BackupPC::Backups::Info;
my $bpcinfo = BackupPC::Backups::Info->new();
...
METHODS
new
Initiates the object.
One variable is taken and that is the back to the BackupPC pool. By default this is '/var/db/BackupPC' if not specified.
my $bpcinfo=BackupPC::Backups::Info->new;
if ( $bpcinfo->error ){
warn("init failed.... the pool directy does not exist or is not accessible");
}
get_dir
This returns the top dir for BackupPC.
There is no need for error checking as long as it did not error upon init.
my $dir=$bpcinfo->get_dir;
get_last
Gets the last line parsed for a for the file.
If the machine has not been parsed yet, it will be and the last entry returned.
Two options are taken.
The first is the machine in question.
The second is perl boolean if it should reread the file even if it already has a last.
The BACKUP HASH for information on the returned hash reference.
my $lastRef=$bpcinfo->get_last($machine)
if ( $bpcinfo->error ){
warn('something happened'.$self->errorstring);
}
get_pc_dir
This returns the directory which will contain the directories for the hosts setup in BackupPC.
There is no need for error checking as long as it did not error upon init.
my $dir=$bpcinfo->get_dir;
if ( $bpcinfo->error ){
warn('something happened'.$self->errorstring);
}
get_parsed
This parses the raw backups file and then returns a array of hashes. For a explanation of the hashes, please see BACKUP HASH.
One archment is taken and that is the machine name.
my @parsed=$bpcinfo->get_parsed($machine);
if ( $bpcinfo->error ){
warn('something happened: '.$self->errorstring);
}
get_raw
This retrieves the law data from a backups file for a machine.
The section on backups file in https://backuppc.github.io/backuppc/BackupPC.html#Storage-layout is suggested reading if you plan on actually using this.
my $raw=$bpcinfo->get_raw('foo');
if ($bpcinfo->error){
warn('something errored');
}
list_machines
This returns an array of machines backed up.
my @machines=$bpcinfo->list_machines;
if ( $bpcinfo->error ){
warn('something happened: '.$self->errorstring);
}
list_parsed
This returns a array the machines that have currently been parsed.
As long as no permanent errors are set, this will not error.
my @parsed=$bpcinfo->list_parsed;
read_in_all
This reads in the backups files for each machine.
Currently this just attempts to read in all via get_parsed and ignores any errors, just proceeding to the next one.
As long as list_machines does not error, this will not error.
$bpcinfo->read_in_all
if ( $bpcinfo->error ){
warn('something happened: '.$self->errorstring);
}
BACKUP HASH
Based on __TOPDIR__/pc/$host/backup from https://backuppc.github.io/backuppc/BackupPC.html#Storage-layout.
num
The backup number for the current hash.
type
Either 'incr' or 'full'.
startTime
The unix start time of the backup.
endTime
The unix end time of the backup.
nFiles
Number of files backed up.
size
Total file size backed up.
nFilesExist
Number of files already in the pool.
sizeExist
Total size of files that were already in the pool.
nFilesNew
Number of new files not already in the pool.
sizeNew
Total size of files not in the pool.
xferErrs
Number of warnings/errors from the backup method.
xferBadFile
Number of errors from the backup method in regards to bad files.
xferBadShare
Number of errors from smbclient that were bad share errors.
tarErrs
Number of errors from BackupPC_tarExtract.
compress
The compression level used on this backup. Zero means no compression.
Please note that while BackupPC may leave this field blank if none is used, this module will check for a blank value and set it to zero.
sizeExistComp
Total compressed size of files that already existed in the pool.
sizeNewComp
Total compressed size of new files in the pool.
noFill
et if this backup has not been filled in with the most recent previous filled or full backup. See $Conf{IncrFill} in the BackupPC docs.
fillFromNum
If filled, this is the backup it was filled from.
mangle
Set if this backup has mangled file names and attributes. Always true for backups in v1.4.0 and above. False for all backups prior to v1.4.0.
xferMethod
The value of $Conf{XferMethod} when this dump was done.
level
ERROR FLAGS
1/backBackupPCdig
/var/db/BackupPC or whatever was specified does not exist or is not a directory.
2/noPCdir
/var/db/BackupPC/pc does not exist or is not a directory.
3/opendir
Opendir failed. Most likely this script needs to be running as the same user as BackupPC.
4/noMachineName
Specify the machine name to operate on.
5/slashmachine
The machine name has a slash in it.
6/noMachine
The machine does not exist.
7/open
Open on a file failed. Please make sure the script is running as the same user as BackupPC.
AUTHOR
Zane C. Bowers-Hadley, <vvelox at vvelox.net>
BUGS
Please report any bugs or feature requests to bug-backuppc-backups-info at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=BackupPC-Backups-Info. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc BackupPC::Backups::Info
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=BackupPC-Backups-Info
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2017 Zane C. Bowers-Hadley.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.