src/Leevel/Protocol/Console/Base/Server.php
protected function checkService(array $option): void
    {
        $file = $option['pid_path'];

        if (!is_file($file)) {
            return;
        }

        $pid = explode(PHP_EOL, file_get_contents($file));

        $cmd = "ps ax | awk '{ print $1 }' | grep -e \"^{$pid[0]}$\"";
        exec($cmd, $out);

        if (!empty($out)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Swoole pid file %s is already exists,pid is %d',
                    $file, $pid[0]
                )
            );
        }

        $this->warn(
            sprintf(
                'Warning:swoole pid file is already exists.',
                $file
            ).
            PHP_EOL.'It is possible that the swoole service was last unusual exited.'.
            PHP_EOL.'The non daemon mode ctrl+c termination is the most possible.'.PHP_EOL
        );

        unlink($file);
    }
protected function checkService(array $option): void
    {
        $file = $option['pid_path'];

        if (!is_file($file)) {
            return;
        }

        $pid = explode(PHP_EOL, file_get_contents($file));

        $cmd = "ps ax | awk '{ print $1 }' | grep -e \"^{$pid[0]}$\"";
        exec($cmd, $out);

        if (!empty($out)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Swoole pid file %s is already exists,pid is %d',
                    $file, $pid[0]
                )
            );
        }

        $this->warn(
            sprintf(
                'Warning:swoole pid file is already exists.',
                $file
            ).
            PHP_EOL.'It is possible that the swoole service was last unusual exited.'.
            PHP_EOL.'The non daemon mode ctrl+c termination is the most possible.'.PHP_EOL
        );

        unlink($file);
    }
验证服务是否被占用.

@param array $option