BBConfig
view release on metacpan or search on metacpan
Revision history for Perl extension BBConfig.
0.03 Added access to bbackupd.conf and bbstored.conf, as well
as 'save()' methods for all supported config files.
0.02 Minor formatting problems fixed
0.01 Tue Nov 15 00:48:14 2005
- original version; created by h2xs 1.23 with options
-X -n BBConfig
lib/BoxBackup/Config/BBackupd.pm view on Meta::CPAN
setMaximumDiffingTime
getExtendedLogging
setExtendedLogging
getCommandSocket
setCommandSocket
);
sub new
{
my ($self, @args) = @_;
my $bbackupdFile = $args[0] || "/etc/box/bbackupd.conf";
my $parser = Config::Scoped->new( file => $bbackupdFile );
$self = $parser->parse;
return bless $self;
}
sub save
{
}
lib/BoxBackup/Config/BBackupd.pm view on Meta::CPAN
# wrapped around the PidFile, but there is no real chance of
# multiple 'Server' sections, at least not at this time.
my $self = shift;
my $pidFile = shift;
return($self->{"Server"}{"PidFile"} = shift);
}
# Shamelessly copied from Ben's distribution bbackupd.conf
#
# BackupLocations specifies which locations on disc should be backed up. Each
# directory is in the format
#
# name
# {
# Path = /path/of/directory
# (optional exclude directives)
# }
#
lib/BoxBackup/Config/BBackupd.pm view on Meta::CPAN
# [Exclude|AlwaysInclude][File|Dir][|sRegex] = regex or full pathname
#
# (The regex suffix is shown as 'sRegex' to make File or Dir plural)
#
# For example:
#
# ExcludeDir = /home/guest-user
# ExcludeFilesRegex = *.(mp3|MP3)$
# AlwaysIncludeFile = /home/username/veryimportant.mp3
#
# This excludes the directory /home/guest-user from the backup along with all mp3
# files, except one MP3 file in particular.
#
# In general, Exclude excludes a file or directory, unless the directory is
# explicitly mentioned in a AlwaysInclude directive.
sub getListOfBackupLocations
{
lib/BoxBackup/Config/BBackupd.pm view on Meta::CPAN
return if $AUTOLOAD =~ /::DESTROY$/;
if($AUTOLOAD =~ /.*::get(\w+)/) # this is a getter
{
my $name = $1;
# For the 'BackupLocations' section we have to get the location
# in question, before we know which parameter value to get.
if($name =~ /AlwaysInclude/ || $name =~ /Exclude/ || $name =~ /Path/)
{
my $backupLocation = shift;
return($self->{"BackupLocations"}{$backupLocation}{$name});
}
else
{
return($self->{$name});
}
}
if($AUTOLOAD =~ /.*::set(\w+)/) # this is a setter
{
my $name = $1;
if($name =~ /AlwaysInclude/ || $name =~ /Exclude/ || $name =~ /Path/)
{
my $backupLocation = shift;
return($self->{"BackupLocations"}{$backupLocation}{$name} = shift);
}
else
{
return($self->{$name} = shift);
}
}
}
1;
t/DiskSet.t view on Meta::CPAN
# its man page ( perldoc Test::More ) for help writing this test script.
use BoxBackup::Config::DiskSets;
$dsk = BoxBackup::Config::DiskSets->new("t/raidfile.conf");
@diskNames = $dsk->getListofDisks();
ok(defined($dsk), 'defined');
ok($dsk->isa('BoxBackup::Config::DiskSets'), 'correct type');
ok($dsk->getParamVal("disc0", "SetNumber") == 0, "SetNumber");
ok($dsk->getParamVal("disc0", "BlockSize") == 4096, "BlockSize");
ok($dsk->getParamVal("disc0", "Dir0") eq "/backup001.0", "Dir0");
ok($dsk->getParamVal("disc0", "Dir1") eq "/backup001.1", "Dir1");
ok($dsk->getParamVal("disc0", "Dir2") eq "/backup001.2", "Dir2");
ok($#diskNames == 1, "element count");
t/bbackupd.conf view on Meta::CPAN
# StoreHostname = planck.reedtz.com
# StoreHostname = localhost
StoreHostname = 66.53.195.133
AccountNumber = 0x1
KeysFile = /etc/box/bbackupd/1-FileEncKeys.raw
CertificateFile = /etc/box/bbackupd/1-cert.pem
PrivateKeyFile = /etc/box/bbackupd/1-key.pem
TrustedCAsFile = /etc/box/bbackupd/serverCA.pem
DataDirectory = /var/bbackupd
# This script is run whenever bbackupd encounters a problem which requires
# the system administrator to assist:
# 1) The store is full, and no more data can be uploaded.
# 2) Some files or directories were not readable.
# The default script emails the system administrator.
NotifyScript = /etc/box/bbackupd/NotifySysadmin.sh
# This configuration file is written for snapshot mode.
# You will need to run bbackupctl to instruct the daemon to upload files.
# AutomaticBackup = no
# UpdateStoreInterval = 0
# MinimumFileAge = 0
# MaxUploadWait = 0
AutomaticBackup = yes
UpdateStoreInterval = 3600
MinimumFileAge = 21600
MaxUploadWait = 86400
t/bbackupd.conf view on Meta::CPAN
# to spend more time searching for unchanged blocks.
MaximumDiffingTime = 20
# Uncomment this line to see exactly what the daemon is going when it's connected to the server.
ExtendedLogging = yes
# Use this to temporarily stop bbackupd from syncronising or connecting to the store.
# This specifies a program or script script which is run just before each sync, and ideally
# the full path to the interpreter. It will be run as the same user bbackupd is running as,
# usually root.
# The script prints either "now" or a number to STDOUT (and a terminating newline, no quotes).
# If the result was "now", then the sync will happen. If it's a number, then the script will
# be asked again in that number of seconds.
# For example, you could use this on a laptop to only backup when on a specific network.
# SyncAllowScript = /path/to/intepreter/or/exe script-name parameters etc
# Where the command socket is created in the filesystem.
CommandSocket = /var/run/bbackupd.sock
Server
{
PidFile = /var/run/bbackupd.pid
}
#
# BackupLocations specifies which locations on disc should be backed up. Each
# directory is in the format
#
# name
# {
# Path = /path/of/directory
# (optional exclude directives)
t/bbackupd.conf view on Meta::CPAN
# [Exclude|AlwaysInclude][File|Dir][|sRegex] = regex or full pathname
#
# (The regex suffix is shown as 'sRegex' to make File or Dir plural)
#
# For example:
#
# ExcludeDir = /home/guest-user
# ExcludeFilesRegex = *.(mp3|MP3)$
# AlwaysIncludeFile = /home/username/veryimportant.mp3
#
# This excludes the directory /home/guest-user from the backup along with all mp3
# files, except one MP3 file in particular.
#
# In general, Exclude excludes a file or directory, unless the directory is
# explicitly mentioned in a AlwaysInclude directive.
#
# If a directive ends in Regex, then it is a regular expression rather than a
# explicit full pathname. See
#
# man 7 re_format
#
# for the regex syntax on your platform.
#
BackupLocations
{
d2-mp3
{
Path = /etc
ExcludeFile = /etc/box/bbackupd/0007-FileEncKeys.raw
ExcludeFile = /etc/hosts
}
}
home
{
Path = /home
}
}
t/raidfile.conf view on Meta::CPAN
disc0
{
SetNumber = 0
BlockSize = 4096
Dir0 = /backup001.0
Dir1 = /backup001.1
Dir2 = /backup001.2
}
disc1
{
SetNumber = 1
BlockSize = 4096
Dir0 = /backup002
Dir1 = /backup002
Dir2 = /backup002
}
( run in 0.777 second using v1.01-cache-2.11-cpan-49f99fa48dc )