mirror of https://github.com/digint/btrbk
btrbk: call init_transaction_log() at the beginning of every action, instead at global place
parent
211964f709
commit
5d65748ffe
33
btrbk
33
btrbk
|
@ -288,16 +288,18 @@ sub ABORTED($;$)
|
||||||
|
|
||||||
sub init_transaction_log($)
|
sub init_transaction_log($)
|
||||||
{
|
{
|
||||||
my $file = shift // die;
|
my $file = shift;
|
||||||
if(open($tlog_fh, ">> $file"))
|
if(defined($file) && (not $dryrun)) {
|
||||||
{
|
if(open($tlog_fh, ">> $file")) {
|
||||||
# print headers and startup message
|
# print headers
|
||||||
print_formatted("transaction", [ ], output_format => "tlog", outfile => $tlog_fh);
|
print_formatted("transaction", [ ], output_format => "tlog", outfile => $tlog_fh);
|
||||||
INFO "Using transaction log: $file";
|
INFO "Using transaction log: $file";
|
||||||
} else {
|
} else {
|
||||||
$tlog_fh = undef;
|
$tlog_fh = undef;
|
||||||
ERROR "Failed to open transaction log '$file': $!";
|
ERROR "Failed to open transaction log '$file': $!";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
action("startup", status => "v$VERSION", message => "$version_info");
|
||||||
}
|
}
|
||||||
|
|
||||||
sub close_transaction_log()
|
sub close_transaction_log()
|
||||||
|
@ -3216,15 +3218,6 @@ MAIN:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# open transaction log
|
|
||||||
#
|
|
||||||
if(($action_run || $action_clean) && (not $dryrun) && config_key($config, "transaction_log")) {
|
|
||||||
init_transaction_log(config_key($config, "transaction_log"));
|
|
||||||
}
|
|
||||||
action("startup", status => "v$VERSION", message => "$version_info");
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# filter subvolumes matching command line arguments
|
# filter subvolumes matching command line arguments
|
||||||
#
|
#
|
||||||
|
@ -3840,6 +3833,8 @@ MAIN:
|
||||||
#
|
#
|
||||||
# identify and delete incomplete backups
|
# identify and delete incomplete backups
|
||||||
#
|
#
|
||||||
|
init_transaction_log(config_key($config, "transaction_log"));
|
||||||
|
|
||||||
my @out;
|
my @out;
|
||||||
foreach my $sroot (vinfo_subsection($config, 'volume')) {
|
foreach my $sroot (vinfo_subsection($config, 'volume')) {
|
||||||
foreach my $svol (vinfo_subsection($sroot, 'subvolume')) {
|
foreach my $svol (vinfo_subsection($sroot, 'subvolume')) {
|
||||||
|
@ -3935,6 +3930,8 @@ MAIN:
|
||||||
|
|
||||||
if($action_run)
|
if($action_run)
|
||||||
{
|
{
|
||||||
|
init_transaction_log(config_key($config, "transaction_log"));
|
||||||
|
|
||||||
if($resume_only) {
|
if($resume_only) {
|
||||||
INFO "Skipping snapshot creation (option \"-r\" present)";
|
INFO "Skipping snapshot creation (option \"-r\" present)";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue