168 |
my $size = (stat( "$tar_dir/$tarfilename" ))[7] || die "can't stat $tar_dir/$tarfilename"; |
my $size = (stat( "$tar_dir/$tarfilename" ))[7] || die "can't stat $tar_dir/$tarfilename"; |
169 |
|
|
170 |
if ($size > $Conf{MaxArchiveSize}) { |
if ($size > $Conf{MaxArchiveSize}) { |
171 |
print STDERR " part bigger than media $size > $Conf{MaxArchiveSize} }}" if ($debug); |
print ", part bigger than media $size > $Conf{MaxArchiveSize}\n"; |
172 |
$same = 0; |
return 0; |
|
last; |
|
173 |
} |
} |
174 |
|
|
175 |
print ", $size bytes"; |
print ", $size bytes"; |
190 |
|
|
191 |
if ($tar_size > $Conf{MaxArchiveFileSize}) { |
if ($tar_size > $Conf{MaxArchiveFileSize}) { |
192 |
print ", part $tarfilename is too big $tar_size > $Conf{MaxArchiveFileSize}\n"; |
print ", part $tarfilename is too big $tar_size > $Conf{MaxArchiveFileSize}\n"; |
193 |
$same = 0; |
return 0; |
|
last; |
|
194 |
} |
} |
195 |
|
|
196 |
} |
} |
197 |
|
|
198 |
print ", $items items"; |
print ", $items items"; |
199 |
|
|
200 |
|
if ($tar_size == 0 && $items == 0) { |
201 |
|
print ", EMPTY tar\n"; |
202 |
|
|
203 |
|
my $backup_id = get_backup_id($host, $share, $num); |
204 |
|
|
205 |
|
my $sth_inc_deleted = $dbh->prepare(qq{ |
206 |
|
update backups set |
207 |
|
inc_deleted = true |
208 |
|
where id = ? |
209 |
|
}); |
210 |
|
$sth_inc_deleted->execute($backup_id); |
211 |
|
|
212 |
|
$dbh->commit; |
213 |
|
|
214 |
|
return 1; |
215 |
|
} |
216 |
|
|
217 |
|
# fix tar_size for tars without any files |
218 |
|
$tar_size ||= 512 * $items; |
219 |
|
|
220 |
|
|
221 |
# |
# |
222 |
# check if md5 exists, and if not, create one |
# check if md5 exists, and if not, create one |
223 |
# |
# |
317 |
my $curr_backup = 1; |
my $curr_backup = 1; |
318 |
|
|
319 |
while (my $row = $sth->fetchrow_hashref) { |
while (my $row = $sth->fetchrow_hashref) { |
320 |
|
|
321 |
|
$curr_backup++; |
322 |
|
|
323 |
my $tar_file = BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'}); |
my $tar_file = BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'}); |
324 |
|
|
325 |
# this will return -1 if file doesn't exist |
# this will return -1 if file doesn't exist |
335 |
} |
} |
336 |
} |
} |
337 |
|
|
338 |
print curr_time, " $curr_backup/$num_backups ", $row->{'host'}, ":", $row->{'share'}, " #", $row->{'num'}, " -> $tar_file"; |
print curr_time, " creating $curr_backup/$num_backups ", $row->{'host'}, ":", $row->{'share'}, " #", $row->{'num'}, " -> $tar_file"; |
|
$curr_backup++; |
|
339 |
|
|
340 |
my $t = time(); |
my $t = time(); |
341 |
|
|