|
File::Rotate::Backup - Make backups of multiple directories and rotate them on unix. |
new(\%params)backup(\@conf)rotate()getArchiveDeleteList()getDirDeleteList()setCompressProgramPath($path)setCompressExtension($ext)setTarPath($path)
File::Rotate::Backup - Make backups of multiple directories and rotate them on unix.
my $params = { archive_copies => 2,
dir_copies => 1,
backup_dir => '/backups',
file_prefix => 'backup_'
secondary_backup_dir => '/backups2',
secondary_archive_copies => 2,
verbose => 1,
use_flock => 1,
};
my $backup = File::Rotate::Backup->new($params);
$backup->backup([ [ '/etc/httpd/conf' => 'httpd_conf' ],
[ '/var/named' => 'named' ],
]);
$backup->rotate;
This module will make backups and rotate them according to your
specification. It creates a backup directory based on the
file_prefix you specify and the current time. It then copies the
directories you specified in the call to new() to that backup
directory. Then a tar'd and compressed file is created from that
directory. By default, bzip2 is used for compression.
This module has only been tested on Linux and Solaris.
The only external programs used are tar and a compression program. Copies and deletes are implemented internally.
new(\%params)
my $params = { archive_copies => 2,
dir_copies => 1,
backup_dir => '/backups',
file_prefix => 'backup_'
secondary_backup_dir => '/backups2',
secondary_archive_copies => 2,
verbose => 1,
use_flock => 1,
dir_regex => '\d+-\d+-\d+_\d+_\d+_\d+',
file_regex => '\d+-\d+-\d+_\d+_\d+_\d+',
};
my $backup = File::Rotate::Backup->new($params);
Creates a backup object.
archive(s) will be created
even if archive_copies is set.
unlink() fails. This may
occur on systems where the file being removed is larger than 2GB
and such files are not fully supported.
backup(\@conf)Makes the backup -- creates the backed up directory and archive file. @conf is an array where each element is either a string or an array. If it is a string, it is expected to be the path to a directory that is to be backed up. If the element is an array, the first element is expected to be a directory that is to be backed up, and the second should be the name the directory is called once it has been copied to the backup directory. The return value is the name of the archive file created; unless 'no_archive' is set, then it will return an empty string.
rotate()Rotates the backup directories and archive files. The number of
archive files to keep and the number of directories to keep are
specified in the new() constructor.
getArchiveDeleteList()Returns a list of archive files that will get deleted if the
rotate() method is called.
getDirDeleteList()Returns a list of directories that will get deleted if the
rotate() method is called.
setCompressProgramPath($path)Set the path to the compression program you want to use when creating the archive files in the call to backup(). The given compression program must provide the same API as gzip and bzip2, at least to the extent that it will except input from stdin and will write output to stdout when no file names are provided. This defaults to 'bzip2' (no explicit path).
setCompressExtension($ext)This sets the extension given to the archive name after the .tar. This defaults to .bz2 if bzip2 is used for compression, and .gz if gzip is used.
setTarPath($path)Set the path to the tar program. This defaults to 'tar' (no explicit path).
Don Owens <don@regexguy.com>
Augie Schwer
Copyright (c) 2003-2007 Don Owens
All rights reserved. This program is free software; you can
redistribute it and/or modify it under the same terms as Perl
itself.
0.12
|
File::Rotate::Backup - Make backups of multiple directories and rotate them on unix. |