mirror of https://github.com/digint/btrbk
btrbk/documentation: rename "resolve *" commands to "list *"; cleanup
parent
288e9e73c8
commit
3f09d2c37f
|
@ -1,9 +1,11 @@
|
|||
btrbk-current
|
||||
|
||||
* Added transaction log (configuration option "transaction_log").
|
||||
* Added configuration option "group".
|
||||
* Allow filtering subcommands by group as well as targets.
|
||||
* Allow filtering of all commands by group as well as targets.
|
||||
* Added "list backups|snapshots|latest|config|source|volume|target"
|
||||
commands (while removing "tree" command).
|
||||
* Added "config print" command.
|
||||
* Added "list" command (experimental).
|
||||
* Added "--format=table|long|raw" and "-t,--table" command line
|
||||
options, producing tabular and raw (machine-readable) output for
|
||||
"(dry)run", "tree" and "list" commands.
|
||||
|
@ -12,7 +14,6 @@ btrbk-current
|
|||
* Added "target raw", with GnuPG and compression support
|
||||
(experimental).
|
||||
* Added configuration option "timestamp_format short|long".
|
||||
* Added transaction log (configuration option "transaction_log").
|
||||
* Replaced "info" command with "usage", with tabular output.
|
||||
* Bugfix: correctly handle "incremental no" option.
|
||||
* Bugfix: return exit status 10 instead of 0 if one or more backup
|
||||
|
|
|
@ -364,7 +364,7 @@ Example: Restore a Snapshot
|
|||
|
||||
First, pick a snapshot to be restored:
|
||||
|
||||
btrbk tree
|
||||
btrbk list snapshots
|
||||
|
||||
From the list, pick the snapshot you want to restore. Let's say it's
|
||||
`/mnt/btr_pool/_btrbk_snap/data.20150101`.
|
||||
|
@ -388,7 +388,7 @@ Example: Restore a Backup
|
|||
|
||||
First, pick a backup to be restored:
|
||||
|
||||
btrbk tree
|
||||
btrbk list backups
|
||||
|
||||
From the list, pick the backup you want to restore. Let's say it's
|
||||
`/mnt/btr_backup/data.20150101`.
|
||||
|
|
108
btrbk
108
btrbk
|
@ -120,8 +120,8 @@ my %config_options = (
|
|||
my @config_target_types = qw(send-receive raw);
|
||||
|
||||
my %table_formats = (
|
||||
list_volume => { table => [ qw( volume_host volume_subvol ) ],
|
||||
long => [ qw( volume_host volume_subvol ) ],
|
||||
list_volume => { table => [ qw( volume_host volume_path ) ],
|
||||
long => [ qw( volume_host volume_path ) ],
|
||||
raw => [ qw( volume_url volume_host volume_path volume_rsh ) ],
|
||||
},
|
||||
list_source => { table => [ qw( source_host source_subvol snapshot_path snapshot_name ) ],
|
||||
|
@ -196,7 +196,7 @@ sub VERSION_MESSAGE
|
|||
|
||||
sub HELP_MESSAGE
|
||||
{
|
||||
print STDERR "usage: btrbk [options] <command>\n";
|
||||
print STDERR "usage: btrbk [options] <command> [filter...]\n";
|
||||
print STDERR "\n";
|
||||
print STDERR "options:\n";
|
||||
# "--------------------------------------------------------------------------------"; # 80
|
||||
|
@ -214,19 +214,24 @@ sub HELP_MESSAGE
|
|||
print STDERR " --progress show progress bar on send-receive operation\n";
|
||||
print STDERR "\n";
|
||||
print STDERR "commands:\n";
|
||||
print STDERR " run [filter...] perform backup operations as defined in the config file\n";
|
||||
print STDERR " dryrun [filter...] don't run btrfs commands; show what would be executed\n";
|
||||
print STDERR " list [filter...] print source/snapshot/target relations\n";
|
||||
print STDERR " resolve snapshots [filter...] shows snapshots and corresponding targets\n";
|
||||
print STDERR " resolve targets [filter...] shows targets and corresponding snapshots\n";
|
||||
print STDERR " resolve latest [filter...] shows latest snapshots/targets\n";
|
||||
print STDERR " usage [filter...] print filesystem usage\n";
|
||||
print STDERR " run perform backup operations as defined in the config file\n";
|
||||
print STDERR " dryrun don't run btrfs commands; show what would be executed\n";
|
||||
print STDERR " list <subcommand> available subcommands are:\n";
|
||||
print STDERR " backups all backups and corresponding snapshots\n";
|
||||
print STDERR " snapshots all snapshots and corresponding backups\n";
|
||||
print STDERR " latest most recent snapshots and backups\n";
|
||||
print STDERR " config configured source/snapshot/target relations\n";
|
||||
print STDERR " source configured source/snapshot relations\n";
|
||||
print STDERR " volume configured volume sections\n";
|
||||
print STDERR " target configured targets\n";
|
||||
print STDERR " usage print filesystem usage\n";
|
||||
print STDERR " origin <subvol> print origin information for subvolume\n";
|
||||
print STDERR " diff <from> <to> shows new files since subvolume <from> for subvolume <to>\n";
|
||||
print STDERR "\n";
|
||||
print STDERR "For additional information, see $PROJECT_HOME\n";
|
||||
}
|
||||
|
||||
|
||||
sub TRACE { my $t = shift; print STDERR "... $t\n" if($loglevel >= 4); }
|
||||
sub DEBUG { my $t = shift; print STDERR "$t\n" if($loglevel >= 3); }
|
||||
sub INFO { my $t = shift; print STDERR "$t\n" if($loglevel >= 2); }
|
||||
|
@ -2136,89 +2141,60 @@ MAIN:
|
|||
}
|
||||
my ($action_run, $action_usage, $action_resolve, $action_diff, $action_origin, $action_config_print, $action_list);
|
||||
my @filter_args;
|
||||
my $args_allow_group = 0;
|
||||
my ($args_expected_min, $args_expected_max) = (0, 0);
|
||||
my $args_allow_group = 1;
|
||||
my $args_expected_min = 0;
|
||||
my $args_expected_max = 9999;
|
||||
if(($command eq "run") || ($command eq "dryrun")) {
|
||||
$action_run = 1;
|
||||
$dryrun = 1 if($command eq "dryrun");
|
||||
$args_expected_min = 0;
|
||||
$args_expected_max = 9999;
|
||||
$args_allow_group = 1;
|
||||
@filter_args = @ARGV;
|
||||
}
|
||||
elsif ($command eq "usage") {
|
||||
$action_usage = 1;
|
||||
$args_expected_min = 0;
|
||||
$args_expected_max = 9999;
|
||||
$args_allow_group = 1;
|
||||
@filter_args = @ARGV;
|
||||
}
|
||||
elsif ($command eq "resolve") {
|
||||
my $subcommand = shift @ARGV // "";
|
||||
if($subcommand eq "snapshots") {
|
||||
$action_resolve = $subcommand;
|
||||
$args_expected_min = 0;
|
||||
$args_expected_max = 9999;
|
||||
$args_allow_group = 1;
|
||||
@filter_args = @ARGV;
|
||||
}
|
||||
elsif($subcommand eq "latest") {
|
||||
$action_resolve = $subcommand;
|
||||
$args_expected_min = 0;
|
||||
$args_expected_max = 9999;
|
||||
$args_allow_group = 1;
|
||||
@filter_args = @ARGV;
|
||||
}
|
||||
elsif($subcommand eq "targets") {
|
||||
$action_resolve = $subcommand;
|
||||
$args_expected_min = 0;
|
||||
$args_expected_max = 9999;
|
||||
$args_allow_group = 1;
|
||||
@filter_args = @ARGV;
|
||||
}
|
||||
else {
|
||||
ERROR "Unknown subcommand for \"resolve\" command: $subcommand";
|
||||
HELP_MESSAGE(0);
|
||||
exit 2;
|
||||
}
|
||||
}
|
||||
elsif ($command eq "diff") {
|
||||
$action_diff = 1;
|
||||
$args_expected_min = $args_expected_max = 2;
|
||||
$args_allow_group = 0;
|
||||
@filter_args = @ARGV;
|
||||
}
|
||||
elsif ($command eq "origin") {
|
||||
$action_origin = 1;
|
||||
$args_expected_min = $args_expected_max = 1;
|
||||
$args_allow_group = 0;
|
||||
@filter_args = @ARGV;
|
||||
}
|
||||
elsif($command eq "list") {
|
||||
my $subcommand = shift @ARGV;
|
||||
$action_list = "target-all";
|
||||
if(defined($subcommand)) {
|
||||
if(($subcommand eq "volume") ||
|
||||
($subcommand eq "source") ||
|
||||
($subcommand eq "target"))
|
||||
{
|
||||
$action_list = $subcommand;
|
||||
}
|
||||
else {
|
||||
unshift @ARGV, $subcommand;
|
||||
}
|
||||
my $subcommand = shift @ARGV // "";
|
||||
if(($subcommand eq "config") ||
|
||||
($subcommand eq "volume") ||
|
||||
($subcommand eq "source") ||
|
||||
($subcommand eq "target"))
|
||||
{
|
||||
$action_list = $subcommand;
|
||||
}
|
||||
elsif(($subcommand eq "snapshots") ||
|
||||
($subcommand eq "backups") ||
|
||||
($subcommand eq "latest"))
|
||||
{
|
||||
$action_resolve = $subcommand;
|
||||
}
|
||||
else {
|
||||
$action_list = "config";
|
||||
unshift @ARGV, $subcommand if($subcommand ne "");
|
||||
}
|
||||
$args_expected_min = 0;
|
||||
$args_expected_max = 9999;
|
||||
$args_allow_group = 1;
|
||||
@filter_args = @ARGV;
|
||||
}
|
||||
elsif ($command eq "config") {
|
||||
my $subcommand = shift @ARGV // "";
|
||||
@filter_args = @ARGV;
|
||||
if(($subcommand eq "print") || ($subcommand eq "print-all")) {
|
||||
$action_config_print = $subcommand;
|
||||
$args_expected_min = 0;
|
||||
$args_expected_max = 9999;
|
||||
$args_allow_group = 1;
|
||||
@filter_args = @ARGV;
|
||||
}
|
||||
elsif($subcommand eq "list") {
|
||||
$action_list = "config";
|
||||
}
|
||||
else {
|
||||
ERROR "Unknown subcommand for \"config\" command: $subcommand";
|
||||
|
@ -2864,7 +2840,7 @@ MAIN:
|
|||
}
|
||||
}
|
||||
}
|
||||
elsif($action_resolve eq "targets")
|
||||
elsif($action_resolve eq "backups")
|
||||
{
|
||||
#
|
||||
# print all targets and their corresponding source snapshots
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#
|
||||
|
||||
|
||||
# Enable transaction log
|
||||
transaction_log /var/log/btrbk.log
|
||||
|
||||
# Directory in which the btrfs snapshots are created. Relative to
|
||||
# <volume-directory> of the volume section.
|
||||
# If not set, the snapshots are created in <volume-directory>.
|
||||
|
@ -64,9 +67,6 @@ snapshot_dir _btrbk_snap
|
|||
# Set this either globally or in a specific "target" section.
|
||||
#btrfs_progs_compat no
|
||||
|
||||
# Enable transaction log
|
||||
#transaction_log /var/log/btrbk_transaction.log
|
||||
|
||||
|
||||
#
|
||||
# Volume section: "volume <volume-directory>"
|
||||
|
|
|
@ -37,7 +37,7 @@ valid mount-points, you can loop through the configuration and mount
|
|||
the volumes like this:
|
||||
|
||||
#!/bin/sh
|
||||
btrbk config list volume --format=raw | while read line; do
|
||||
btrbk list volume --format=raw | while read line; do
|
||||
eval $line
|
||||
$volume_rsh mount $volume_path
|
||||
done
|
||||
|
|
56
doc/btrbk.1
56
doc/btrbk.1
|
@ -9,7 +9,9 @@ btrbk \- backup tool for btrfs volumes
|
|||
.nf
|
||||
\fBbtrbk\fR [\-h|\-\-help] [\-\-version] [\-c|\-\-config <file>]
|
||||
[\-p|\-\-preserve] [\-r|\-\-resume\-only]
|
||||
[\-v|\-\-verbose] [\-q|\-\-quiet] [\-l|\-\-loglevel <level>] [\-\-progress]
|
||||
[\-v|\-\-verbose] [\-q|\-\-quiet] [\-l|\-\-loglevel <level>]
|
||||
[\-t|\-\-table] [\-\-format <output\-format>]
|
||||
[\-\-progress]
|
||||
<command> [<args>]
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
|
@ -64,7 +66,8 @@ set to \[lq]yes\[rq] in the configuration file.
|
|||
.PP
|
||||
\-v, \-\-verbose
|
||||
.RS 4
|
||||
Verbose output. Identical to: \-l info.
|
||||
Verbose output. Sets "\-l info", and prints detailed scheduler
|
||||
information on "run" and "dryrun" commands.
|
||||
.RE
|
||||
.PP
|
||||
\-q, \-\-quiet
|
||||
|
@ -142,23 +145,39 @@ would be executed.
|
|||
.RE
|
||||
.PP
|
||||
.B list
|
||||
[filter...]
|
||||
<subcommand> [filter...]
|
||||
.RS 4
|
||||
Print the source/snapshot/target relations of the configured
|
||||
subvolumes in a tabular form. Optionally filtered by [filter...]
|
||||
arguments (see \fIFILTER STATEMENTS\fR below). Accepts predefined
|
||||
filters \fIvolume\fR, \fIsource\fR and \fItarget\fR. Use the
|
||||
\fI\-\-format\fR command line option to switch between different
|
||||
output formats.
|
||||
.RE
|
||||
Print information defined by <subcommand> in a tabular form. Optionally
|
||||
filtered by [filter...] arguments (see \fIFILTER STATEMENTS\fR
|
||||
below).
|
||||
.PP
|
||||
.B tree
|
||||
[filter...]
|
||||
.RS 4
|
||||
Print the snapshots and their corresponding backup subvolumes as a
|
||||
tree. Optionally filtered by [filter...] arguments (see \fIFILTER
|
||||
STATEMENTS\fR below). Use the \fI\-\-format\fR command line option to
|
||||
switch between different output formats.
|
||||
Available subcommands:
|
||||
.TP 11
|
||||
.B snapshots
|
||||
All snapshots (and corresponding backups).
|
||||
.PD 0
|
||||
.TP 11
|
||||
.B backups
|
||||
All backups (and corresponding snapshots).
|
||||
.TP 11
|
||||
.B latest
|
||||
Most recent snapshots and backups.
|
||||
.TP 11
|
||||
.B config
|
||||
Configured source/snapshot/target relations.
|
||||
.TP 11
|
||||
.B source
|
||||
Configured source/snapshot relations.
|
||||
.TP 11
|
||||
.B volume
|
||||
Configured volume sections.
|
||||
.TP 11
|
||||
.B target
|
||||
Configured targets.
|
||||
.PD
|
||||
.PP
|
||||
Use the \fI\-\-format\fR command line option to switch between
|
||||
different output formats.
|
||||
.RE
|
||||
.PP
|
||||
.B usage
|
||||
|
@ -193,7 +212,8 @@ Filter arguments are accepted in form:
|
|||
.PP
|
||||
[hostname:]<volume-directory>
|
||||
.RS 4
|
||||
Matches all subvolumes and targets of a \fIvolume\fR configuration section.
|
||||
Matches all subvolumes and targets of a \fIvolume\fR configuration
|
||||
section.
|
||||
.RE
|
||||
.PP
|
||||
[hostname:]<volume-directory>/<subvolume-name>
|
||||
|
|
|
@ -105,6 +105,13 @@ be able to delete old backups.
|
|||
.RE
|
||||
.SH OPTIONS
|
||||
.PP
|
||||
\fBtransaction_log\fR <file>
|
||||
.RS 4
|
||||
If set, all transactions (snapshot create, subvolume send-receive,
|
||||
subvolume delete) as well as abort messages are logged to <file>, in a
|
||||
space-separated table format.
|
||||
.RE
|
||||
.PP
|
||||
\fBtimestamp_format\fR short|long
|
||||
.RS 4
|
||||
Timestamp format used as postfix for new snapshot subvolume names.
|
||||
|
@ -258,13 +265,6 @@ can lead to false guesses if the snapshot or target subvolumes are
|
|||
manipulated by hand (moved, deleted).
|
||||
.RE
|
||||
.PP
|
||||
\fBtransaction_log\fR <file>
|
||||
.RS 4
|
||||
If set, all transactions (snapshot create, subvolume send-receive,
|
||||
subvolume delete) as well as abort messages are logged to <file>, in a
|
||||
space-separated table format.
|
||||
.RE
|
||||
.PP
|
||||
Lines that contain a hash character (#) in the first column are
|
||||
treated as comments.
|
||||
.SH AVAILABILITY
|
||||
|
|
Loading…
Reference in New Issue