true, "ts" => date("c"), "doctrine" => "64-ZERO-MANUAL-TASK"]; function check_root_crontab($pattern) { $out = @shell_exec("sudo -u root crontab -l 2>/dev/null"); return $out && preg_match($pattern, $out); } function check_cron($pattern) { foreach (glob("/etc/cron.d/*") as $f) { $c = @file_get_contents($f); if ($c && preg_match($pattern, $c)) return true; } return false; } function check_any($paths) { foreach ((array)$paths as $p) { if (strpos($p, "*") !== false) { if (glob($p)) return true; } elseif (file_exists($p)) return true; } return false; } $auto = [ "crm_pipeline_sync" => check_any(["/etc/cron.d/crm-sequences","/etc/cron.d/crm-observation","/var/www/html/api/crm-api.php","/opt/weval-l99/crm-observation.py"]) || check_cron("/crm-sequences|crm-api/"), "crm_observation_daily" => check_any(["/etc/cron.d/crm-observation","/opt/weval-l99/crm-observation.py"]) || check_cron("/crm-observation/"), "blade_selfheal" => check_any(["/etc/cron.d/blade-autoheal","/etc/cron.d/automation-blade-selfheal","/opt/weval-l99/blade-selfheal.py"]) || check_cron("/blade.*heal|heal.*blade/"), "blade_tasks_cleanup" => check_any(["/etc/cron.d/blade-autoheal","/var/www/html/api/blade-tasks-cleanup.php"]), "ovh_cancel" => check_any(["/etc/cron.d/automation-ovh-daily","/opt/weval-l99/ovh-s151-cancel.py"]) || check_cron("/ovh/"), "azure_rotation" => check_any(["/var/www/html/api/azure-reregister-api.php"]), "nonreg_guard" => check_any(["/var/www/html/api/nonreg-master.php"]), "l99_auto_update" => check_any(["/var/www/html/api/l99-honest.php","/var/www/html/api/handlers/l99-honest-refresh.sh"]), "ethica_enrich" => check_any(["/opt/weval-l99/ethica-sync-to-send_contacts.py"]) || check_cron("/ethica/"), "wevia_master_autoheal" => check_any(["/var/www/html/api/wevia-master-autoheal.php"]) || check_cron("/wevia-master-autoheal/"), "wevia_agent_chef" => check_cron("/wevia-agent-chef/"), "wevia_agent_evolution" => check_cron("/wevia-agent-evolution/"), "wevia_autowire_agent" => check_cron("/wevia-autowire-agent/"), "wevia_cortex" => check_cron("/wevia-cortex/"), "wevia_daily_standup" => check_cron("/wevia-daily-standup/"), "health_monitor" => check_cron("/health-monitor/"), "sso_guardian" => check_any(["/opt/weval-l99/wevia-sso-guardian.py","/opt/weval-l99/wevia-sso-systemic.py"]) || check_cron("/sso-guardian|sso-systemic/") || check_root_crontab("/sso-guardian|sso-systemic/"), "weval_watchdog" => check_any(["/var/www/html/api/weval-watchdog.php","/var/www/html/api/fpm-watchdog.php","/var/www/html/api/opus5-sovereign-watchdog.php","/var/www/html/api/qdrant-watchdog.php"]), "biz_scenario_cron" => check_cron("/biz-scenario|v94/"), ]; $out["automations"] = []; $active = 0; $total = count($auto); foreach ($auto as $k => $v) { $out["automations"][$k] = ["status" => $v ? "active" : "missing"]; if ($v) $active++; } $out["autonomy_score"] = round(100 * $active / $total, 1); $out["autonomy_active"] = $active; $out["autonomy_total"] = $total; $out["autonomy_sigma"] = ($active === $total) ? "6sigma" : "not-6sigma"; // Pending items $pending_file = "/var/www/html/api/automation-pending.json"; $out["pending"] = []; if (is_readable($pending_file)) { $out["pending"] = json_decode(@file_get_contents($pending_file), true) ?: []; } // Global counts $out["crons_count"] = count(glob("/etc/cron.d/*")); $out["scripts_count"] = count(glob("/opt/weval-l99/*.py")) + count(glob("/opt/weval-l99/*.sh")); $out["watchdogs_count"] = count(glob("/var/www/html/api/*watchdog*.php")); echo json_encode($out, JSON_PRETTY_PRINT);