From a7082b76fdd37d7b69718f477f1628f74b251d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 18 Nov 2021 16:40:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ServerCommand.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ServerCommand.php b/ServerCommand.php index 63b4a0b..5b9ec43 100644 --- a/ServerCommand.php +++ b/ServerCommand.php @@ -63,10 +63,14 @@ class ServerCommand extends Command if (!in_array($input->getArgument('action'), self::ACTIONS)) { throw new Exception('I don\'t know what I want to do.'); } - if ($manager->isRunner() && $input->getArgument('action') == 'start') { - throw new Exception('Service is running. Please use restart.'); + + $reusePort = Config::get('server.settings')[Constant::OPTION_ENABLE_REUSE_PORT] ?? false; + if (!$reusePort) { + if ($manager->isRunner() && $input->getArgument('action') == 'start') { + throw new Exception('Service is running. Please use restart.'); + } + $manager->shutdown(); } - $manager->shutdown(); if ($input->getArgument('action') == 'stop') { throw new Exception('shutdown success'); }