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'); }