mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +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:
parent
340d27abe1
commit
a389416b15
@ -29,7 +29,7 @@ use warnings;
|
|||||||
sub CommandBackup($$);
|
sub CommandBackup($$);
|
||||||
sub parseConfig($);
|
sub parseConfig($);
|
||||||
sub readModpath($$);
|
sub readModpath($$);
|
||||||
sub createArchiv($$);
|
sub createArchiv($$$);
|
||||||
|
|
||||||
my @pathname;
|
my @pathname;
|
||||||
|
|
||||||
@ -48,6 +48,7 @@ CommandBackup($$)
|
|||||||
{
|
{
|
||||||
my ($cl, $param) = @_;
|
my ($cl, $param) = @_;
|
||||||
|
|
||||||
|
my $byUpdate = ($param && $param eq "startedByUpdate");
|
||||||
my $modpath = AttrVal("global", "modpath","");
|
my $modpath = AttrVal("global", "modpath","");
|
||||||
my $configfile = AttrVal("global", "configfile", "");
|
my $configfile = AttrVal("global", "configfile", "");
|
||||||
my $statefile = AttrVal("global", "statefile", "");
|
my $statefile = AttrVal("global", "statefile", "");
|
||||||
@ -100,7 +101,7 @@ CommandBackup($$)
|
|||||||
$ret = readModpath($modpath,$backupdir);
|
$ret = readModpath($modpath,$backupdir);
|
||||||
|
|
||||||
# create archiv
|
# create archiv
|
||||||
$ret = createArchiv($backupdir, $cl);
|
$ret = createArchiv($backupdir, $cl, $byUpdate);
|
||||||
|
|
||||||
@pathname = [];
|
@pathname = [];
|
||||||
undef @pathname;
|
undef @pathname;
|
||||||
@ -165,9 +166,9 @@ readModpath($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
createArchiv($$)
|
createArchiv($$$)
|
||||||
{
|
{
|
||||||
my ($backupdir,$cl) = @_;
|
my ($backupdir,$cl,$byUpdate) = @_;
|
||||||
my $backupcmd = (!defined($attr{global}{backupcmd}) ? undef : $attr{global}{backupcmd});
|
my $backupcmd = (!defined($attr{global}{backupcmd}) ? undef : $attr{global}{backupcmd});
|
||||||
my $symlink = (!defined($attr{global}{backupsymlink}) ? "no" : $attr{global}{backupsymlink});
|
my $symlink = (!defined($attr{global}{backupsymlink}) ? "no" : $attr{global}{backupsymlink});
|
||||||
my $tarOpts;
|
my $tarOpts;
|
||||||
@ -197,7 +198,7 @@ createArchiv($$)
|
|||||||
|
|
||||||
}
|
}
|
||||||
Log 2, "Backup with command: $cmd";
|
Log 2, "Backup with command: $cmd";
|
||||||
if(!$fhemForked) {
|
if(!$fhemForked && !$byUpdate) {
|
||||||
use Blocking;
|
use Blocking;
|
||||||
our $BC_telnetDevice;
|
our $BC_telnetDevice;
|
||||||
BC_searchTelnet("backup");
|
BC_searchTelnet("backup");
|
||||||
|
@ -250,8 +250,8 @@ doUpdate($$$$)
|
|||||||
|
|
||||||
if(AttrVal("global", "backup_before_update", 0) &&
|
if(AttrVal("global", "backup_before_update", 0) &&
|
||||||
$arg ne "check" && $curr==1) {
|
$arg ne "check" && $curr==1) {
|
||||||
my $cmdret = AnalyzeCommand(undef, "backup");
|
my $cmdret = AnalyzeCommand(undef, "backup startedByUpdate");
|
||||||
if($cmdret !~ m/backup done.*|Started.*in the background/) {
|
if ($cmdret !~ m/backup done.*/) {
|
||||||
uLog 1, "Something went wrong during backup: $cmdret";
|
uLog 1, "Something went wrong during backup: $cmdret";
|
||||||
uLog 1, "update was canceled. Please check manually!";
|
uLog 1, "update was canceled. Please check manually!";
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user