2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

98_backup.pm/98_update.pm: better fix for backup_before_update=1 & updateInBackground=0 (Forum #82614)

git-svn-id: https://svn.fhem.de/fhem/trunk@15862 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-01-12 21:01:28 +00:00
parent 340d27abe1
commit a389416b15
2 changed files with 8 additions and 7 deletions

View File

@ -29,7 +29,7 @@ use warnings;
sub CommandBackup($$);
sub parseConfig($);
sub readModpath($$);
sub createArchiv($$);
sub createArchiv($$$);
my @pathname;
@ -48,6 +48,7 @@ CommandBackup($$)
{
my ($cl, $param) = @_;
my $byUpdate = ($param && $param eq "startedByUpdate");
my $modpath = AttrVal("global", "modpath","");
my $configfile = AttrVal("global", "configfile", "");
my $statefile = AttrVal("global", "statefile", "");
@ -100,7 +101,7 @@ CommandBackup($$)
$ret = readModpath($modpath,$backupdir);
# create archiv
$ret = createArchiv($backupdir, $cl);
$ret = createArchiv($backupdir, $cl, $byUpdate);
@pathname = [];
undef @pathname;
@ -165,9 +166,9 @@ readModpath($$)
}
sub
createArchiv($$)
createArchiv($$$)
{
my ($backupdir,$cl) = @_;
my ($backupdir,$cl,$byUpdate) = @_;
my $backupcmd = (!defined($attr{global}{backupcmd}) ? undef : $attr{global}{backupcmd});
my $symlink = (!defined($attr{global}{backupsymlink}) ? "no" : $attr{global}{backupsymlink});
my $tarOpts;
@ -197,7 +198,7 @@ createArchiv($$)
}
Log 2, "Backup with command: $cmd";
if(!$fhemForked) {
if(!$fhemForked && !$byUpdate) {
use Blocking;
our $BC_telnetDevice;
BC_searchTelnet("backup");

View File

@ -250,8 +250,8 @@ doUpdate($$$$)
if(AttrVal("global", "backup_before_update", 0) &&
$arg ne "check" && $curr==1) {
my $cmdret = AnalyzeCommand(undef, "backup");
if($cmdret !~ m/backup done.*|Started.*in the background/) {
my $cmdret = AnalyzeCommand(undef, "backup startedByUpdate");
if ($cmdret !~ m/backup done.*/) {
uLog 1, "Something went wrong during backup: $cmdret";
uLog 1, "update was canceled. Please check manually!";
return;