r8608@llin: dpavlin | 2005-10-16 13:23:59 +0200
authordpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Sun, 16 Oct 2005 12:33:02 +0000 (12:33 +0000)
committerdpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Sun, 16 Oct 2005 12:33:02 +0000 (12:33 +0000)
 fix for rename, show current and total number of increments

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@213 8392b6e1-25fa-0310-8288-cc32f8e212ea

bin/BackupPC_incPartsUpdate

index 7e04e08..9995cde 100755 (executable)
@@ -82,20 +82,23 @@ order by backups.date
 
 } );
 
-$sth->execute();
-
 my $sth_inc_size = $dbh->prepare(qq{ update backups set inc_size = ?, parts = ? where id = ? });
 my $sth_inc_deleted = $dbh->prepare(qq{ update backups set inc_deleted = ? where id = ? });
 
 %BackupPC::SearchLib::Conf = %Conf;
 
+$sth->execute();
+my $num_backups = $sth->rows;
+my $curr_backup = 1;
+
 while (my $row = $sth->fetchrow_hashref) {
        my $tar_file = BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'});
 
        # this will return -1 if file doesn't exist
        my $size = BackupPC::SearchLib::get_tgz_size_by_name($tar_file);
 
-       print curr_time, " ", $row->{'host'}, ":", $row->{'share'}, " #", $row->{'num'}, " -> $tar_file";
+       print curr_time, " $curr_backup/$num_backups ", $row->{'host'}, ":", $row->{'share'}, " #", $row->{'num'}, " -> $tar_file";
+       $curr_backup++;
 
        my $t = time();
 
@@ -106,7 +109,7 @@ while (my $row = $sth->fetchrow_hashref) {
 
                system($cmd) == 0 or die "failed: $?";
 
-               rename "${tar_dir}/${$tar_file}.tmp", "$tar_dir/$tar_file" or die "can't rename $tar_dir/$tar_file: $!";
+               rename("${tar_dir}/${tar_file}.tmp", "$tar_dir/$tar_file") or die "can't rename $tar_dir/$tar_file: $!";
 
                $size = (stat( "$tar_dir/$tar_file" ))[7];
        }