btrbk: added more information on backup summary; added documentation

pull/30/head
Axel Burri 2015-01-17 14:55:46 +01:00
parent f02caad81f
commit 6a00736a2b
2 changed files with 47 additions and 25 deletions

35
btrbk
View File

@ -279,13 +279,6 @@ sub check_file($$$$)
sub parse_config(@)
{
my @config_files = @_;
my $root = { CONTEXT => "root" };
my $cur = $root;
# set defaults
foreach (keys %config_options) {
$root->{$_} = $config_options{$_}->{default};
}
my $file = undef;
foreach(@config_files) {
TRACE "config: checking for file: $_";
@ -299,6 +292,13 @@ sub parse_config(@)
return undef;
}
my $root = { CONTEXT => "root", SRC_FILE => $file };
my $cur = $root;
# set defaults
foreach (keys %config_options) {
$root->{$_} = $config_options{$_}->{default};
}
DEBUG "config: parsing file: $file";
open(FILE, '<', $file) or die $!;
while (<FILE>) {
@ -866,6 +866,7 @@ MAIN:
$ENV{PATH} = '';
$Getopt::Std::STANDARD_HELP_VERSION = 1;
$Data::Dumper::Sortkeys = 1;
my $start_time = time;
my @today = Today();
my %opts;
@ -1323,6 +1324,8 @@ MAIN:
}
}
my $time_elapsed = time - $start_time;
INFO "Completed within: ${time_elapsed}s";
#
# print summary
@ -1331,7 +1334,9 @@ MAIN:
{
my $err_count = 0;
print "--------------------------------------------------------------------------------\n";
print "Backup Summary ($version_info)\n";
print "Backup Summary ($version_info)\n\n";
print " Date: " . localtime($start_time) . "\n";
print " Config: $config->{SRC_FILE}\n";
print "--------------------------------------------------------------------------------";
foreach my $config_vol (@{$config->{VOLUME}})
{
@ -1351,10 +1356,10 @@ MAIN:
# print(($_->{preserve} ? "===" : "---") . " $_->{name}\n");
# }
# }
if($config_subvol->{subvol_deleted}) {
print "--- $_\n" foreach(@{$config_subvol->{subvol_deleted}});
}
print "+++ $config_subvol->{snapshot}\n" if($config_subvol->{snapshot});
if($config_subvol->{subvol_deleted}) {
print "--- $_\n" foreach(sort { $b cmp $a} @{$config_subvol->{subvol_deleted}});
}
foreach my $config_target (@{$config_subvol->{TARGET}})
{
if($config_target->{ABORTED}) {
@ -1366,10 +1371,10 @@ MAIN:
# print(($_->{preserve} ? "===" : "---") . " $_->{name}\n");
# }
# }
if($config_target->{subvol_deleted}) {
print "--- $_\n" foreach(@{$config_target->{subvol_deleted}});
}
print "+++ $config_target->{subvol_created}\n" if($config_target->{subvol_created});
if($config_target->{subvol_deleted}) {
print "--- $_\n" foreach(sort { $b cmp $a} @{$config_target->{subvol_deleted}});
}
}
}
}
@ -1378,7 +1383,7 @@ MAIN:
print "Please check warning and error messages above.\n";
}
if($dryrun) {
print "\nNOTE: Dryrun was active, none of the operations below were actually executed!\n";
print "\nNOTE: Dryrun was active, none of the operations above were actually executed!\n";
}
}
}

View File

@ -3,11 +3,12 @@
# Create snapshot into subdirectory
snapshot_dir _btrbk_snap
# Always create backups, even if the target volume is not reachable
# Always create snapshots, even if the target volume is unreachable
snapshot_create_always yes
# Perform incremental backups
incremental strict
# Perform incremental backups (set to "strict" if you want to prevent
# creation of initial backups if no parent is found)
incremental yes
# ssh key for ssh volumes/targets
ssh_identity /etc/btrbk/ssh/id_ed25519
@ -29,7 +30,16 @@ target_preserve_monthly all
# Make sure the deletion of subvolumes is committed to disk when btrbk terminates
btrfs_commit_delete after
# Dump verbose output of "btrfs receive" to a specified file. If set
# to "sidecar", the file will be named "<backup_subvolume>.btrbk.log".
# Note that this log file can become very big, as every change of
# every file is being logged.
#receive_log /var/log/btrbk_receive.log
#receive_log sidecar
receive_log no
#
# Volume section: "volume <vol_dir>"
# <vol_dir>: Directory of a btrfs volume (or subvolume) containing the
# subvolume to be backuped (usually the mount-point of a
@ -39,9 +49,17 @@ btrfs_commit_delete after
# <subvol>: Subvolume to be backuped, relative to <vol_dir> in
# volume section
#
# Target section: "target <type> <subvol_dir>"
# Target section: "target <type> <vol_dir>"
# <type>: Backup type, currently only "send-receive"
# <subvol_dir>: Directory of a btrfs volume (or subvolume) receiving the backups
# <vol_dir>: Directory of a btrfs volume (or subvolume) receiving the backups
#
#
# NOTE: The parser does not care about indentation, this is only for
# human readability. The options always apply to the last section
# encountered, overriding the corresponding option of the upper
# section. This means that the global options must be set before any
# "volume" section.
#
volume /mnt/btr_system
subvolume root_gentoo
@ -58,7 +76,6 @@ volume /mnt/btr_system
target_preserve_weekly 0
target send-receive /mnt/btr_backup/_btrbk
receive_log sidecar
volume /mnt/btr_data