Exakat\Tasks\CleanDb::doRestart PHP Метод

doRestart() приватный Метод

private doRestart ( )
    private function doRestart()
    {
        $round = 0;
        do {
            ++$round;
            if ($round > 0) {
                sleep($round);
            }
            if ($round > 10) {
                if (file_exists($this->config->neo4j_folder . '/data/neo4j-service.pid')) {
                    $pid = file_get_contents($this->config->neo4j_folder . '/data/neo4j-service.pid');
                    die('Couldn\'t restart neo4j\'s server. Please, kill it (kill -9 ' . $pid . ') and try again');
                } else {
                    die('Couldn\'t restart neo4j\'s server, though it doesn\'t seem to be running. Please, make sure it is runnable at "' . $this->config->neo4j_folder . '" and try again.');
                }
            }
            echo exec('cd ' . $this->config->neo4j_folder . '; ./bin/neo4j start >/dev/null 2>&1 & ');
            // Might be : Another server-process is running with [49633], cannot start a new one. Exiting.
            // Needs to pick up this error and act
            // also, may be we can wait for the pid to appear?
            $res = $this->gremlin->serverInfo();
        } while ($res === false);
    }