---- Changes since 1.470 ----
When terminating a running backup, all sub-processes such as tar and dump commands are killed too.
Converted the UI on Solaris, OSX and FreeBSD to use the new Webmin UI library.
+---- Changes since 1.510 ----
+Fixed verification when a dump is to a date-based destination and takes more than one day.
}
else {
# Do the dump
- $ok = &execute_dump($dump, STDOUT, 1, 0);
+ $now = time();
+ $ok = &execute_dump($dump, STDOUT, 1, 0, $now);
print "</pre>\n";
if (!$bok) {
print "<b>$text{'backup_afterfailed'}</b><p>\n";
if ($dump->{'reverify'}) {
print "<b>$text{'backup_reverify'}</b><p>\n";
print "<pre>";
- $ok = &verify_dump($dump, STDOUT, 1, 0);
+ $ok = &verify_dump($dump, STDOUT, 1, 0, $now);
print "</pre>";
}
if ($ok) {
}
else {
# Do the backup
- $ok = &execute_dump($dump, OUT, 0, 1);
+ $now = time();
+ $ok = &execute_dump($dump, OUT, 0, 1, $now);
# Re-update the status file
if ($ok) {
# Worked .. but verify if asked
if ($dump->{'reverify'}) {
print OUT "\n$text{'email_verify'}\n";
- $ok = &verify_dump($dump, OUT, 0, 1);
+ $ok = &verify_dump($dump, OUT, 0, 1, $now);
}
if ($ok) {
$status{'status'} = 'complete';
}
}
-# execute_dump(&dump, filehandle, escape)
+# execute_dump(&dump, filehandle, escape, background-mode, [time])
# Executes a dump and displays the output
sub execute_dump
{
if ($_[0]->{'huser'}) {
$flags = "-f '$_[0]->{'huser'}\@$_[0]->{'host'}:".
- &date_subs($_[0]->{'hfile'})."'";
+ &date_subs($_[0]->{'hfile'}, $_[4])."'";
}
elsif ($_[0]->{'host'}) {
- $flags = "-f '$_[0]->{'host'}:".&date_subs($_[0]->{'hfile'})."'";
+ $flags = "-f '$_[0]->{'host'}:".&date_subs($_[0]->{'hfile'}, $_[4])."'";
}
else {
- $flags = "-f '".&date_subs($_[0]->{'file'})."'";
+ $flags = "-f '".&date_subs($_[0]->{'file'}, $_[4])."'";
}
local $tapecmd = $_[0]->{'multi'} && $_[0]->{'fs'} eq 'tar' ? $multi_cmd :
$_[0]->{'multi'} ? undef :
return lc($fs1) eq lc($fs2);
}
-# date_subs(string)
+# date_subs(string, [time])
sub date_subs
{
if ($config{'date_subs'}) {
eval "use POSIX";
eval "use posix" if ($@);
- local @tm = localtime(time());
+ local @tm = localtime($_[1] || time());
&clear_time_locale();
local $rv = strftime($_[0], @tm);
&reset_time_locale();
$_[0]->{'erase'} = $in{'erase'};
}
-# execute_dump(&dump, filehandle, escape)
+# execute_dump(&dump, filehandle, escape, background-mode, [time])
# Executes a dump and displays the output
sub execute_dump
{
local ($cmd, $flag);
if ($_[0]->{'huser'}) {
$flag = " -f '$_[0]->{'huser'}\@$_[0]->{'host'}:".
- &date_subs($_[0]->{'hfile'})."'";
+ &date_subs($_[0]->{'hfile'}, $_[4])."'";
}
elsif ($_[0]->{'host'}) {
- $flag = " -f '$_[0]->{'host'}:".&date_subs($_[0]->{'hfile'})."'";
+ $flag = " -f '$_[0]->{'host'}:".&date_subs($_[0]->{'hfile'}, $_[4])."'";
}
else {
- $flag = " -f '".&date_subs($_[0]->{'file'})."'";
+ $flag = " -f '".&date_subs($_[0]->{'file'}, $_[4])."'";
}
$cmd = "xfsdump -l $_[0]->{'level'}";
$cmd .= $flag;
$_[0]->{'remount'} = $in{'remount'};
}
-# execute_dump(&dump, filehandle, escape, background-mode)
+# execute_dump(&dump, filehandle, escape, background-mode, [time])
# Executes a dump and displays the output
sub execute_dump
{
local $fh = $_[1];
local ($cmd);
-($flag, $hfile) = &dump_flag($_[0]);
+($flag, $hfile) = &dump_flag($_[0], $_[4]);
local $tapecmd = $_[0]->{'multi'} && $_[0]->{'fs'} eq 'tar' ? $multi_cmd :
$_[0]->{'notape'} ? undef :
$_[0]->{'multi'} ? undef :
return ($flag, $hfile);
}
-# verify_dump(&dump, filehandle, escape, background-mode)
+# verify_dump(&dump, filehandle, escape, background-mode, [time])
# Verifies a dump, returning 1 if OK and 0 if not
sub verify_dump
{
# Build verify command
local $fh = $_[1];
local $vcmd;
-local ($flag, $hfile) = &dump_flag($_[0]);
+local ($flag, $hfile) = &dump_flag($_[0], $_[4]);
if ($_[0]->{'fs'} eq "tar") {
$vcmd = "tar -t -v";
$vcmd .= " -z" if ($_[0]->{'gzip'} == 1);
$_[0]->{'offline'} = $in{'offline'};
}
-# execute_dump(&dump, filehandle, escape)
+# execute_dump(&dump, filehandle, escape, background-mode, [time])
# Executes a dump and displays the output
sub execute_dump
{
$cmd .= "o" if ($_[0]->{'offline'});
if ($_[0]->{'huser'}) {
$cmd .= "f '$_[0]->{'huser'}\@$_[0]->{'host'}:".
- &date_subs($_[0]->{'hfile'})."'";
+ &date_subs($_[0]->{'hfile'}, $_[4])."'";
}
elsif ($_[0]->{'host'}) {
- $cmd .= "f '$_[0]->{'host'}:".&date_subs($_[0]->{'hfile'})."'";
+ $cmd .= "f '$_[0]->{'host'}:".&date_subs($_[0]->{'hfile'}, $_[4])."'";
}
else {
- $cmd .= "f '".&date_subs($_[0]->{'file'})."'";
+ $cmd .= "f '".&date_subs($_[0]->{'file'}, $_[4])."'";
}
$cmd .= " $_[0]->{'extra'}" if ($_[0]->{'extra'});
local @dirs = $_[0]->{'tabs'} ? split(/\t+/, $_[0]->{'dir'})