From ada2b5038fa65e03fadca6a7cf749e83e001c1e2 Mon Sep 17 00:00:00 2001 From: markusbloch <> Date: Sat, 22 Aug 2015 16:46:24 +0000 Subject: [PATCH] PRESENCE: rescheduling new check if fork fails (by frank, Forum: #40119) git-svn-id: https://svn.fhem.de/fhem/trunk@9111 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/73_PRESENCE.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fhem/FHEM/73_PRESENCE.pm b/fhem/FHEM/73_PRESENCE.pm index 14733e89c..e3ebdaf24 100755 --- a/fhem/FHEM/73_PRESENCE.pm +++ b/fhem/FHEM/73_PRESENCE.pm @@ -550,6 +550,18 @@ sub PRESENCE_StartLocalScan($;$) $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalFunctionScan", $name."|".$hash->{helper}{call}."|".$local, "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash); } + if(!$hash->{helper}{RUNNING_PID}) + { + delete($hash->{helper}{RUNNING_PID}); + + my $seconds = (ReadingsVal($name, "state", "absent") eq "present" ? $hash->{TIMEOUT_PRESENT} : $hash->{TIMEOUT_NORMAL}); + + Log3 $hash->{NAME}, 4, "PRESENCE ($name) - fork failed, rescheduling next check in $seconds seconds"; + + RemoveInternalTimer($hash); + InternalTimer(gettimeofday()+$seconds, "PRESENCE_StartLocalScan", $hash, 0) unless($hash->{helper}{DISABLED}); + } + return undef; } else