20 lines
685 B
PHP
20 lines
685 B
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
$procs = @shell_exec("ps auxf 2>/dev/null | grep -E "playwright|chromium" | grep -v grep | head -5");
|
|
$logs = glob("/tmp/ambre-pw-*.log");
|
|
$latest_logs = [];
|
|
foreach ($logs as $l) {
|
|
$latest_logs[] = [
|
|
"file" => basename($l),
|
|
"size" => filesize($l),
|
|
"tail" => @shell_exec("tail -c 1500 $l 2>/dev/null"),
|
|
];
|
|
}
|
|
$script = "/var/www/html/api/v76-scripts/playwright-check.sh";
|
|
$first = file_exists($script) ? substr(@file_get_contents($script), 0, 500) : "NOT FOUND";
|
|
echo json_encode([
|
|
"running" => trim($procs ?? "none"),
|
|
"logs" => $latest_logs,
|
|
"script_preview" => $first,
|
|
], JSON_PRETTY_PRINT);
|