0) { $cfile= fopen($commandName, "r"); if ($cfile) { $cmd= fread($cfile,10000); echo("command\n$cmd\n"); fclose($cfile); unlink($commandName); $cmd= preg_replace("/\n/", " ", $cmd); doLog($cmd, "command-exec"); exit; } } // Check if capture interval has expired, try capture if (isset($webcam['captureInterval']) && $webcam['captureInterval']>0) { $long= $webcam['longitude']; $lat= $webcam['latitude']; $zenith= 98; $ss= date_sunset(time(), SUNFUNCS_RET_TIMESTAMP, $lat, $long, $zenith); $sr= date_sunrise(time(), SUNFUNCS_RET_TIMESTAMP, $lat, $long, $zenith); //Wind Intervall if (file_exists("/tmp/wind-".$webcam['name'].".txt")){ $webcam['captureInterval']=$webcam['captureIntervalWind']; } //Storm Intervall if (file_exists("/tmp/storm-".$webcam['name'].".txt")){ $webcam['captureInterval']=$webcam['captureIntervalStorm']; } //Night Intervall if (isNight()) { if (isset($webcam['captureIntervalNight'])){ $webcam['captureInterval']=$webcam['captureIntervalNight']; } if ($webcam['gewitterForecast'] && file_exists("/tmp/wind-".$webcam['kurzName'].".txt")){ if (isset($webcam['captureIntervalGewitter'])){ $webcam['captureInterval']=$webcam['captureIntervalGewitter']; } else if (isset($webcam['captureIntervalWind'])){ $webcam['captureInterval']=$webcam['captureIntervalWind']; } } } $myTime = time(); if (isset($webcam['captureOffset'])){ $myTime += $webcam['captureOffset']; } //Sunset Intervall if (($myTime < ($ss)) && ($myTime > ($ss-3600))) { if (isset($webcam['captureIntervalSS'])){ $webcam['captureInterval']=$webcam['captureIntervalSS']; } } //Sunrise Intervall if (($myTime > ($sr-1800)) && ($myTime < ($sr+1800))) { if (isset($webcam['captureIntervalSR'])){ $webcam['captureInterval']=$webcam['captureIntervalSR']; } } $lastCapture= $webcam['workPath']."/tmp/lastCapture.txt"; $now= time(); // honour configured offset, shown time includes offset if (isset($webcam['captureOffset'])) { $now-= $webcam['captureOffset']; } $towait= ($now % $webcam['captureInterval']); // Catch some more impressions from new year firework or else $mom= strftime("%m%d%H%M", $now); if (preg_match($webcam['specialTimes'], $mom)) { $towait= 0; } // Conditions for capturing: // - time frame within 20sec after interval has come // - last capture trigger is longer than 60sec old if ($towait<55 && ($now-@filemtime($lastCapture))>60) { // remember this event by file timestamp touch($lastCapture, $now); // generate image stamp $stamp= strftime("%Y%m%d_%H%M", $now); // generate command for camera host $webcam['lastCommand']= $now; echo("command\n$now\nwebcam_capture $stamp\n"); doLog("state=capture-command stamp=$stamp", "info"); exit; } } usleep(500000); // wait 500ms } //doLog("end of waiting...", "idle"); */ ?>