199 |
# |
# |
200 |
|
|
201 |
my $max_file_size = $Conf{'MaxArchiveFileSize'} || die "problem with MaxArchiveFileSize parametar"; |
my $max_file_size = $Conf{'MaxArchiveFileSize'} || die "problem with MaxArchiveFileSize parametar"; |
|
$max_file_size *= 1024; |
|
202 |
|
|
203 |
my $tar_dir = $Conf{InstallDir}.'/'.$Conf{GzipTempDir}; |
my $tar_dir = $Conf{InstallDir}.'/'.$Conf{GzipTempDir}; |
204 |
die "problem with $tar_dir, check GzipTempDir in configuration\n" unless (-d $tar_dir && -w $tar_dir); |
die "problem with $tar_dir, check GzipTempDir in configuration\n" unless (-d $tar_dir && -w $tar_dir); |
222 |
my ($backup_id) = $sth->fetchrow_array; |
my ($backup_id) = $sth->fetchrow_array; |
223 |
$sth->finish; |
$sth->finish; |
224 |
|
|
225 |
|
|
226 |
|
# delete exising backup_parts |
227 |
|
my $sth_delete_backup_parts = $dbh->prepare(qq{ |
228 |
|
delete from backup_parts |
229 |
|
where backup_id = ? |
230 |
|
}); |
231 |
|
$sth_delete_backup_parts->execute($backup_id); |
232 |
|
|
233 |
|
|
234 |
print STDERR "backup_id: $backup_id working dir: $tar_dir, max uncompressed size $max_file_size bytes, tar $tar_file\n" if ($opts{d}); |
print STDERR "backup_id: $backup_id working dir: $tar_dir, max uncompressed size $max_file_size bytes, tar $tar_file\n" if ($opts{d}); |
235 |
|
|
236 |
if (-e $tar_path_final) { |
if (-e $tar_path_final) { |
252 |
if ($fh) { |
if ($fh) { |
253 |
return if ($current_tar_size == 0); |
return if ($current_tar_size == 0); |
254 |
|
|
255 |
print STDERR " $part" if ($opts{v}); |
print STDERR " $part"; |
256 |
|
|
257 |
# |
# |
258 |
# Finish with two null 512 byte headers, |
# Finish with two null 512 byte headers, |
280 |
$items_in_part, |
$items_in_part, |
281 |
); |
); |
282 |
|
|
|
#$total_increment_size += int( ( $size + 1023 ) / 1024 ) * 1024; |
|
283 |
$total_increment_size += $size; |
$total_increment_size += $size; |
284 |
|
|
285 |
if ($arg->{close}) { |
if ($arg->{close}) { |
291 |
} |
} |
292 |
|
|
293 |
if ($part == 1) { |
if ($part == 1) { |
294 |
print STDERR " single"; |
print STDERR " single" if ($opts{v}); |
295 |
move("${tar_path}/1.tar.gz", "${tar_path_final}.tar.gz"); |
move("${tar_path}/1.tar.gz", "${tar_path_final}.tar.gz"); |
296 |
move("${tar_path}/1.md5", "${tar_path_final}.md5"); |
move("${tar_path}/1.md5", "${tar_path_final}.md5"); |
297 |
rmtree $tar_path or die "can't remove temporary dir $tar_path: $!"; |
rmtree $tar_path or die "can't remove temporary dir $tar_path: $!"; |
298 |
} else { |
} else { |
299 |
print STDERR " [last]"; |
print STDERR " [last]" if ($opts{v}); |
300 |
move("${tar_path}", "${tar_path_final}"); |
move("${tar_path}", "${tar_path_final}"); |
301 |
|
|
302 |
|
# if this archive was single part, remove it |
303 |
|
foreach my $suffix (qw/.tar.gz .md5/) { |
304 |
|
my $path = $tar_path_final . $suffix; |
305 |
|
unlink $path if (-e $path); |
306 |
|
} |
307 |
} |
} |
308 |
|
|
309 |
$sth_inc_size->execute( |
$sth_inc_size->execute( |