From bbe6e27a26cd9178f268c163dc4650d5914d50c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 29 Mar 2021 12:12:23 +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/Shutdown.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/HttpServer/Shutdown.php b/HttpServer/Shutdown.php index c4fcb987..f1a94b83 100644 --- a/HttpServer/Shutdown.php +++ b/HttpServer/Shutdown.php @@ -32,8 +32,6 @@ class Shutdown extends Component */ public function init() { - exec('ps -eo pid', $this->_pids); - $this->taskDirectory = storage(null, 'pid/task'); $this->workerDirectory = storage(null, 'pid/worker'); $this->managerDirectory = storage(null, 'pid/manager'); @@ -99,12 +97,9 @@ class Shutdown extends Component if (intval($content) < 1) { return false; } - - $id = Config::get('id', false, 'system'); - - $shell = 'ps -eo pid,state | grep \'%s\' | grep -v grep'; - exec(sprintf($shell, $id . '[' . intval($content) . ']'), $output, $code); - if (empty($output)) { + exec('ps -eo pid', $this->_pids); + var_dump($this->_pids); + if (in_array($content, $this->_pids)) { return false; } return true; @@ -114,6 +109,7 @@ class Shutdown extends Component /** * @param string $path * @return bool + * @throws ConfigException */ public function directoryCheck(string $path): bool { @@ -134,13 +130,14 @@ class Shutdown extends Component /** * @param string $value + * @throws ConfigException */ public function close(string $value) { $content = file_get_contents($value); while ($this->pidIsExists($content)) { - exec('kill -15 ' . $content); +// exec('kill -15 ' . $content); sleep(1); }