* Tue Feb 25 2025 Brian Read <brianr@koozali.org> 11.0.0-58.sme
- re-organise open db placement [SME: 12695] - Re-arrange parameters to tar to avoid warning message in logs [SME: 12943]
This commit is contained in:
@@ -135,7 +135,11 @@ sub do_display {
|
||||
$c->stash(compressionlevel => $CompressionLevel, exclude => \@exclude, directories => \@directories);
|
||||
|
||||
# streaming download in template
|
||||
return $c->render("/backdown");
|
||||
$c->render(template=>"backdown");
|
||||
#sleep(30);
|
||||
# Redirect to the front page
|
||||
#$c->redirect_to('/backup');
|
||||
return ""
|
||||
} ## end if ($function eq 'desktop_backup')
|
||||
|
||||
if ($function eq 'tape_configure') {
|
||||
@@ -2020,4 +2024,4 @@ sub vmount {
|
||||
return (qx(/bin/mount -t nfs -o nolock,timeo=30,retrans=1,retry=0 "$host:/$share" $mountdir 2>&1));
|
||||
}
|
||||
} ## end sub vmount
|
||||
1;
|
||||
1;
|
@@ -19,29 +19,38 @@
|
||||
my $cmd = "/bin/tar --create --file=- --directory / @{$c->stash('exclude')} "
|
||||
. "@{$c->stash('directories')} | /usr/bin/gzip $clvl ";
|
||||
|
||||
#die("$cmd");
|
||||
|
||||
my $success = open my $fh, '-|', $cmd;
|
||||
unless ($success) { return "Error dowload command."; };
|
||||
|
||||
# Write chunk
|
||||
$c->res->headers->content_type('application/x-tar');
|
||||
$c->res->headers->content_disposition(qq/attachment; filename="smeserver.tgz"/);
|
||||
|
||||
my $cb;
|
||||
$cb = sub {
|
||||
my $c = shift;
|
||||
my $size = 500 * 1024;
|
||||
my $length = sysread($fh, my $buffer, $size);
|
||||
unless ($length) {
|
||||
close $fh;
|
||||
undef $cb;
|
||||
$c->finish;
|
||||
return;
|
||||
}
|
||||
$c->write_chunk($buffer, $cb);
|
||||
};
|
||||
$c->$cb;
|
||||
#unless ($success) { return "Error download command."; };
|
||||
if ($success) {
|
||||
# Try with download plugin - seems to fail to complete download and also
|
||||
# name of file deposited is not as required.
|
||||
#my $output = do { local $/; <$fh> };
|
||||
#close $fh;
|
||||
#$c->render_file(
|
||||
#data => $output,
|
||||
#filename => 'output.txt',
|
||||
#content_type => 'text/plain'
|
||||
#);
|
||||
# So organise it ourselves.
|
||||
$c->res->headers->content_type('application/x-tar');
|
||||
$c->res->headers->content_disposition(qq/attachment; filename="smeserver.tgz"/);
|
||||
my $cb;
|
||||
$cb = sub {
|
||||
my $c = shift;
|
||||
my $size = 500 * 1024;
|
||||
my $length = sysread($fh, my $buffer, $size);
|
||||
unless ($length) {
|
||||
close $fh;
|
||||
undef $cb;
|
||||
$c->finish;
|
||||
return;
|
||||
}
|
||||
$c->write_chunk($buffer, $cb);
|
||||
};
|
||||
$c->$cb;
|
||||
} else {
|
||||
$c->render(text => "Failed to execute command: $!", status => 500);
|
||||
}
|
||||
|
||||
# Remove the dumped tables.
|
||||
$status = system("/sbin/e-smith/signal-event", "post-backup", "desktop");
|
||||
@@ -54,4 +63,5 @@
|
||||
$backup_rec->set_prop('EndEpochTime', "$now");
|
||||
$backup_rec->set_prop('Result', "0");
|
||||
|
||||
%>
|
||||
%>
|
||||
1;
|
Reference in New Issue
Block a user