Exemplo n.º 1
0
function getLatestRecording()
{
    $config = json_decode(getMotionConfig(), true);
    $targetDir = $config["target_dir"];
    ob_start();
    system("ls -atR " . $targetDir . "/*image.jpg | head -n 1");
    $filename = trim(ob_get_clean());
    //print "\"".$filename."\"";
    return $filename;
}
Exemplo n.º 2
0
            $log = getRoot() . "/web/api/monitor.log";
            $command = getRoot() . "/script/monitor.sh > " . $log;
            //print($command);
            system("echo '' > " . $log);
            system($command . " &");
        }
        exit(0);
    }
    if ($_GET["action"] == "stop") {
        monitor_stop();
        exit(0);
    }
}
if ($_GET["operation"] == "status") {
    if ($_GET["action"] == "all") {
        $motionConfig = json_decode(getMotionConfig(), true);
        $targetFree = round(disk_free_space($motionConfig["target_dir"]) / 1024 / 1024 / 1024, 2) . "gb";
        ob_start();
        system('/opt/vc/bin/vcgencmd measure_temp');
        $temp = split("=", ob_get_clean())[1];
        $motionRunning = isMonitorRunning();
        ob_start();
        system("tail -n 10 monitor.log");
        $log = nl2br(ob_get_clean());
        $data = ["targetFree" => $targetFree, "motionRunning" => $motionRunning, "log" => $log, "temp" => $temp];
        jsonResponse($data);
    }
}
header('HTTP/1.1 500 Internal Server Error');
print "Did not understand input parameters.<br/>";
print $_SERVER['QUERY_STRING'];