Re: Cronjob bricht nach einiger Zeit ab - liegt wohl an einem Fehler im PHP-Script - brauche Hilfe
Verfasst: 18 Aug 2022, 17:45
Du hast eine PN wegen der API....
Der Platz für alle wetterbegeisterten Hobbymeteorologen
https://www.wetterstationsforum.info/
Code: Alles auswählen
----------------------------------------
18.08.2022 - 21:00:01>> - uv locked - Transfer OK1
Zeit URL 0.644659
----------------------------------------
18.08.2022 - 21:01:02>> ----------------------------------------
18.08.2022 - 21:02:02>> ----------------------------------------
18.08.2022 - 21:03:01>> - uv locked - Transfer OK1
Zeit URL 0.066075
Code: Alles auswählen
----------------------------------------
19.08.2022 - 05:10:01>> Curl-Fehler: Operation timed out after 45001 milliseconds with 0 bytes received
Zeit URL 45.001386
----------------------------------------
19.08.2022 - 05:11:01>> too many requests - try again later 1
Zeit URL 0.054943
----------------------------------------
19.08.2022 - 05:12:01>> - uv locked - Transfer OK1
Zeit URL 0.071726
----------------------------------------
19.08.2022 - 05:13:01>> Curl-Fehler: Operation timed out after 45000 milliseconds with 0 bytes received
Zeit URL 45.000469
Code: Alles auswählen
$urlAWb = fopen("http://ws.awekas.at/weatherstation/updateweatherstation.php?ID=$ID&PASSWORD=$PASSWORD&action=$action&dateutc=$dateutc&tempf=$tempfb&dewptf=$dewptfb&humidity=$humidityb&winddir=$winddirb&windspeedmph=$windspeedmphb&windgustmph=$boeb&baromin=$barominb", "r") or die('Server-Error');
fclose($urlAWb);
Code: Alles auswählen
Sekunden
Mittelwert 0,326366568872988
Standardfehler 0,07939455877986
Modus 0,065008
Median 0,069496
Erstes Quartil 0,066149
Drittes Quartil 0,0756355
Varianz 3,52365424379136
Standardabweichung 1,87713991055312
Wölbung 229,614641925198
Schräge 13,9681242167974
Bereich 34,978372
Minimum 0,060592
Maximum 35,038964
Summe 182,438912
Anzahl 559
Code: Alles auswählen
....
$curlStr = "http://ws.awekas.at/weatherstation/updateweatherstation.php?ID=$IDp&PASSWORD=$PASSWORDp&action=$actionp&dateutc=$dateutcp&tempf=$tempfb&dewptf=$dewptfb&humidity=$humidityb&winddir=$winddirb&windspeedmph=$windspeedmphb&windgustmph=$windgustmphb&baromin=$barominb";
date_default_timezone_set("Europe/Berlin");
$datum = date("d.m.Y");
$uhrzeit = date("H:i:s");
echo $datum," - ",$uhrzeit,": ";
// cURL initialisieren
$ch = curl_init();
// cURL Optionen setzen
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $curlStr);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 40);
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
// cURL ausführen (Daten an den Browser weiterreichen) - Ergebnis in Variable speichern
$returncode = @curl_exec($ch);
if($returncode === false)
{
echo "Error\nZeit: error\n";
echo 'Curl-Fehler: ' . curl_error($ch);
}
else
{
$info = curl_getinfo($ch);
switch ($info['http_code'])
{
case 200: # OK
echo "Ok -> Access Time:". $info['total_time'] ."\n";
break;
default:
echo 'Error -> Unerwarteter HTTP-Code: ', $info['http_code'], "\n";
echo "$returncode";
}
}
Code: Alles auswählen
xxx@DMZ2:~# ./calcAwekas.sh
No of requests 9198
No of errors 116
Availabilty 98.73885627310284844600
Code: Alles auswählen
./calcAwekas.sh
No of requests 19374
No of errors 235
Availabilty 98.78703416950552286600
Code: Alles auswählen
./calcAwekas.sh
No of requests 29520
No of errors 444
Availabilty 98.49593495934959349600
Code: Alles auswählen
No of requests 50494
No of errors 1011
Availabilty 97.99778191468293262600