mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 01:46:08 +00:00
98_update.pm: go in background for single-file (Forum #137382)
git-svn-id: https://svn.fhem.de/fhem/trunk@28624 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
42df9d7e68
commit
c72e514984
@ -49,6 +49,9 @@ CommandUpdate($$)
|
|||||||
my ($cl,$param) = @_;
|
my ($cl,$param) = @_;
|
||||||
my @args = split(/ +/,$param);
|
my @args = split(/ +/,$param);
|
||||||
|
|
||||||
|
return "An update is already running" if($upd_running);
|
||||||
|
$upd_running = 1;
|
||||||
|
|
||||||
my $err = upd_metainit(0);
|
my $err = upd_metainit(0);
|
||||||
return $err if($err);
|
return $err if($err);
|
||||||
|
|
||||||
@ -73,13 +76,14 @@ CommandUpdate($$)
|
|||||||
my $ret = eval { "Hello" =~ m/$arg/ };
|
my $ret = eval { "Hello" =~ m/$arg/ };
|
||||||
return "first argument must be a valid regexp, all, force, check or checktime"
|
return "first argument must be a valid regexp, all, force, check or checktime"
|
||||||
if($arg =~ m/^[-\?\*]/ || $ret);
|
if($arg =~ m/^[-\?\*]/ || $ret);
|
||||||
$arg = lc($arg) if($arg =~ m/^(check|checktime|all|force)$/i);
|
|
||||||
|
|
||||||
$updateInBackground = AttrVal("global","updateInBackground",1);
|
$updateInBackground = AttrVal("global","updateInBackground",1);
|
||||||
$updateInBackground = 0 if($arg ne "all");
|
if($arg =~ m/^(check|checktime|all|force)$/i) {
|
||||||
|
$arg = lc($arg);
|
||||||
|
$updateInBackground = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$updArg = $arg;
|
$updArg = $arg;
|
||||||
return "An update is already running" if($upd_running);
|
|
||||||
$upd_running = 1;
|
|
||||||
if($updateInBackground) {
|
if($updateInBackground) {
|
||||||
CallFn($cl->{NAME}, "ActivateInformFn", $cl, "log") if($cl);
|
CallFn($cl->{NAME}, "ActivateInformFn", $cl, "log") if($cl);
|
||||||
sub updDone(@) { $upd_running=0 }
|
sub updDone(@) { $upd_running=0 }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user