38516-vm/healthz.php
2026-02-17 15:52:38 +00:00

18 lines
384 B
PHP

<?php
declare(strict_types=1);
function isBotRunning(): bool {
$output = [];
exec("ps aux | grep 'node index.js' | grep -v grep", $output);
return !empty($output);
}
if (isBotRunning()) {
http_response_code(200);
echo "Bot is ONLINE";
} else {
// Optionally try to restart it? No, just report status
http_response_code(503);
echo "Bot is OFFLINE";
}