BackupPC::Backups::Info - Restrieves info on BackupPC backups.
Version 0.1.1
Quick summary of what the module does.
Perhaps a little code snippet.
use BackupPC::Backups::Info; my $bpcinfo = BackupPC::Backups::Info->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"); }
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;
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); }
This returns the directory which will contain the directories for the hosts setup in BackupPC.
my $dir=$bpcinfo->get_dir; if ( $bpcinfo->error ){ warn('something happened'.$self->errorstring); }
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); }
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'); }
This returns an array of machines backed up.
my @machines=$bpcinfo->list_machines; if ( $bpcinfo->error ){ warn('something happened: '.$self->errorstring); }
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;
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); }
Based on __TOPDIR__/pc/$host/backup from https://backuppc.github.io/backuppc/BackupPC.html#Storage-layout.
The backup number for the current hash.
Either 'incr' or 'full'.
The unix start time of the backup.
The unix end time of the backup.
Number of files backed up.
Total file size backed up.
Number of files already in the pool.
Total size of files that were already in the pool.
Number of new files not already in the pool.
Total size of files not in the pool.
Number of warnings/errors from the backup method.
Number of errors from the backup method in regards to bad files.
Number of errors from smbclient that were bad share errors.
Number of errors from BackupPC_tarExtract.
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.
Total compressed size of files that already existed in the pool.
Total compressed size of new files in the pool.
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.
If filled, this is the backup it was filled from.
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.
The value of $Conf{XferMethod} when this dump was done.
/var/db/BackupPC or whatever was specified does not exist or is not a directory.
/var/db/BackupPC/pc does not exist or is not a directory.
Opendir failed. Most likely this script needs to be running as the same user as BackupPC.
Specify the machine name to operate on.
The machine name has a slash in it.
The machine does not exist.
Open on a file failed. Please make sure the script is running as the same user as BackupPC.
Zane C. Bowers-Hadley, <vvelox at vvelox.net>
<vvelox at vvelox.net>
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.
bug-backuppc-backups-info at rt.cpan.org
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
http://annocpan.org/dist/BackupPC-Backups-Info
CPAN Ratings
http://cpanratings.perl.org/d/BackupPC-Backups-Info
Search CPAN
http://search.cpan.org/dist/BackupPC-Backups-Info/
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.
To install BackupPC::Backups::Info, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BackupPC::Backups::Info
CPAN shell
perl -MCPAN -e shell install BackupPC::Backups::Info
For more information on module installation, please visit the detailed CPAN module installation guide.