Scalr\System\Zmq\Cron\AbstractTask::terminateWorker PHP Method

terminateWorker() private method

Terminates one worker by specified pid
private terminateWorker ( integer $pid )
$pid integer The identifier of the process
    private function terminateWorker($pid)
    {
        $op = [];
        exec('ps x -o command -p ' . intval($pid) . ' | grep -v "ps x -o command|grep " | grep -i "' . $this->name . '"', $op);
        if (isset($op[1])) {
            $this->getLogger()->debug("Terminating child process PID:%d", $pid);
            //Process is running. Terminate it.
            posix_kill($pid, SIGTERM);
        }
        if (isset($this->pids[$pid])) {
            unset($this->pids[$pid]);
        }
    }