From 91fa46b04e21d68fe518f8e6e93b607967b4ad3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 21 Oct 2020 16:06:20 +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 --- HttpServer/Events/OnManagerStart.php | 10 ++++++++++ HttpServer/Events/OnShutdown.php | 11 ----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/HttpServer/Events/OnManagerStart.php b/HttpServer/Events/OnManagerStart.php index cb27f279..e4f2f2ca 100644 --- a/HttpServer/Events/OnManagerStart.php +++ b/HttpServer/Events/OnManagerStart.php @@ -28,6 +28,16 @@ class OnManagerStart extends Callback if (Snowflake::isLinux()) { name('Server Manager.'); } + + pcntl_signal(9 | 15, function () use ($server) { + $status = 0; + while ($ret = pcntl_waitpid($server->manager_pid, $status)) { + + var_dump($ret); + + break; + } + }); } } diff --git a/HttpServer/Events/OnShutdown.php b/HttpServer/Events/OnShutdown.php index ecc39f31..4468b56f 100644 --- a/HttpServer/Events/OnShutdown.php +++ b/HttpServer/Events/OnShutdown.php @@ -35,17 +35,6 @@ class OnShutdown extends Callback { $this->debug('server shutdown~'); - $workers = glob(storage(null, 'worker') . '/*'); - foreach ($workers as $worker) { - $content = file_get_contents($worker); - posix_kill($content, 9); - } - - $content = '[error]: ' . date('Y-m-d H:i:s') . PHP_EOL; - $content .= print_r(swoole_last_error(), true); - - Snowflake::writeFile(storage('shutdown.log'), $content, FILE_APPEND); - $this->system_mail('server shutdown~'); $event = Snowflake::app()->getEvent(); $event->trigger(Event::SERVER_SHUTDOWN);