public function getTaskStatus($taskId) { $statusFile = AJXP_CACHE_DIR . "/cmd_outputs/task_" . $taskId . ".status"; if (file_exists($statusFile)) { $c = explode(":", file_get_contents($statusFile)); if ($c[0] == "RUNNING" && isset($c[1]) && is_numeric($c[1])) { $process = new UnixProcess(); $process->setPid(intval($c[1])); $s = $process->status(); if ($s === false) { // Process was probably killed! $this->setTaskStatus($taskId, "KILLED", true); return array("KILLED"); } } return $c; } return false; }
public function getWebSocketStatus() { $wDir = $this->getPluginWorkDir(true); $pidFile = $wDir . DIRECTORY_SEPARATOR . "ws-pid"; if (!file_exists($pidFile)) { return "OFF"; } else { $pId = file_get_contents($pidFile); $unixProcess = new UnixProcess(); $unixProcess->setPid($pId); $status = $unixProcess->status(); if ($status) { return "ON"; } else { return "OFF"; } } }