"; #UUID die Überwacht werden soll $TNmax=390; $vzc='/var/www/volkszaehler.org/bin/vzclient'; setlocale(LC_TIME, "de_DE.utf8"); $now=time(); $to=$now*1000; $from=$to-(60*60*1000); #die Zeit muss größer sein wie der 2x Abstand der Aufrufe $url = "http://localhost/api/data/".$uuid.".json?from=".$from."&to=".$to."&options=raw"; $contents = file_get_contents($url); $data=json_decode($contents,true); $last = end($data['data']['tuples']); print vztime($to)."\t"; if ( $last['0']<($to-($TNmax*1000)) and $last['1'] > 0){ $cmd=$vzc.' -u '.$uuid.' add data value=0'; # die aktuelle Zeit wird verwendet #print $cmd."\n"; print vztime($last['0'])."\t".$last['1']."\n"; $output = shell_exec($cmd); print $output."\n"; } #Funktionen function vztime($time){ $int=round($time/1000); return strftime ("%a %d.%m.%Y %H:%M",$int); } ?>