--- a/bin/ftbackup Fri Apr 29 12:20:03 2011 +0200
+++ b/bin/ftbackup Fri Apr 29 16:25:17 2011 +0200
@@ -25,7 +25,7 @@
my $HOSTNAME = hostname;
my $NOW = time();
-my $opt_level = undef;
+my $opt_level = 7;
my $opt_today = strftime("%F", localtime $NOW);
my @opt_debug = ();
my $opt_verbose = 0;
@@ -536,6 +536,7 @@
sub calculate_level($@) {
my ($cycle, @devs) = @_;
+
foreach my $dev (@devs) {
if (defined $opt_level) {
$dev->{level} = $opt_level;
@@ -546,24 +547,18 @@
{
$dev->{level} = 0;
}
- else { $dev->{level} = 1 }
+ else { $dev->{level} = 0 }
# now we'll see if the level really saves space compared
# with the next lower level
my @estimates;
- while (my $l = $dev->{level} > 0) {
+ while ((my $l = $dev->{level}) > 0) {
$estimates[$l] //= get_estimate($dev, $l);
$estimates[$l - 1] //= get_estimate($dev, $l - 1);
-
- last
- if my $savings =
- ($estimates[$l - 1] - $estimates[$l]) / $estimates[$l - 1] >=
- 0.10;
- warn
-"% savings for level $dev->{level} on $dev->{dev} are @{[int($savings * 100)]}%: ",
- "will use level ", $dev->{level} - 1, "\n";
+ last if ($estimates[$l - 1] - $estimates[$l]) / $estimates[$l - 1] >= 0.10;
--$dev->{level};
}
+ warn "% $dev->{dev} will use level $dev->{level}\n";
}
return @devs;
@@ -680,9 +675,9 @@
=item B<-l>|B<--level> I<level>
-The backup level. Level other than "0" needs a previous
-level 0 (full) backup. If not specified, it is choosen automagically.
-(default: undef)
+The proposed backup level. If there are less then 10% savings compared
+with a lower level, or if no lower level exists, the level is incremented.
+(default: 7)
=item B<-L>|B<--label> I<label>