改名
This commit is contained in:
@@ -12,6 +12,7 @@ use Snowflake\Abstracts\Input;
|
|||||||
use Snowflake\Exception\ComponentException;
|
use Snowflake\Exception\ComponentException;
|
||||||
use Snowflake\Exception\ConfigException;
|
use Snowflake\Exception\ConfigException;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
|
use Swoole\Coroutine;
|
||||||
use Swoole\WebSocket\Server;
|
use Swoole\WebSocket\Server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,9 +56,9 @@ trait Action
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$content = file_get_contents($pid_file);
|
$content = file_get_contents($pid_file);
|
||||||
exec("ps -ef $content | grep $content", $output);
|
Coroutine\System::exec("ps -ef $content | grep $content", $output);
|
||||||
if (!empty($output)) {
|
if (!empty($output)) {
|
||||||
exec("kill -15 $content");
|
Coroutine\System::exec("kill -15 $content");
|
||||||
}
|
}
|
||||||
$this->close($server);
|
$this->close($server);
|
||||||
}
|
}
|
||||||
@@ -107,7 +108,7 @@ trait Action
|
|||||||
}
|
}
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$content = file_get_contents($file->getRealPath());
|
$content = file_get_contents($file->getRealPath());
|
||||||
exec("ps -ax | awk '{ print $1 }' | grep -e '^{$content}$'", $output);
|
Coroutine\System::exec("ps -ax | awk '{ print $1 }' | grep -e '^{$content}$'", $output);
|
||||||
if (count($output) > 0) {
|
if (count($output) > 0) {
|
||||||
$this->closeByPid($content);
|
$this->closeByPid($content);
|
||||||
} else {
|
} else {
|
||||||
@@ -137,9 +138,9 @@ trait Action
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Snowflake::isLinux()) {
|
if (Snowflake::isLinux()) {
|
||||||
exec('netstat -tunlp | grep ' . $port, $output);
|
Coroutine\System::exec('netstat -tunlp | grep ' . $port, $output);
|
||||||
} else {
|
} else {
|
||||||
exec('lsof -i :' . $port . ' | grep -i "LISTEN"', $output);
|
Coroutine\System::exec('lsof -i :' . $port . ' | grep -i "LISTEN"', $output);
|
||||||
}
|
}
|
||||||
if (empty($output)) {
|
if (empty($output)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -153,7 +154,7 @@ trait Action
|
|||||||
*/
|
*/
|
||||||
private function closeByPid($pid)
|
private function closeByPid($pid)
|
||||||
{
|
{
|
||||||
exec("ps -ef | grep $pid | grep -v grep | grep -v kill
|
Coroutine\System::exec("ps -ef | grep $pid | grep -v grep | grep -v kill
|
||||||
if [ $? -eq 0 ];then
|
if [ $? -eq 0 ];then
|
||||||
kill -9 `ps -ef | grep $pid | grep -v grep | grep -v kill | awk '{print $2}'`
|
kill -9 `ps -ef | grep $pid | grep -v grep | grep -v kill | awk '{print $2}'`
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
namespace HttpServer;
|
namespace HttpServer;
|
||||||
|
|
||||||
use Annotation\IAnnotation;
|
|
||||||
use HttpServer\Abstracts\HttpService;
|
use HttpServer\Abstracts\HttpService;
|
||||||
use HttpServer\Events\OnClose;
|
use HttpServer\Events\OnClose;
|
||||||
use HttpServer\Events\OnConnect;
|
use HttpServer\Events\OnConnect;
|
||||||
@@ -23,12 +22,9 @@ use Snowflake\Exception\ComponentException;
|
|||||||
use Snowflake\Exception\ConfigException;
|
use Snowflake\Exception\ConfigException;
|
||||||
use Snowflake\Exception\NotFindClassException;
|
use Snowflake\Exception\NotFindClassException;
|
||||||
use Snowflake\Process\Biomonitoring;
|
use Snowflake\Process\Biomonitoring;
|
||||||
use Snowflake\Process\ServerInotify;
|
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
use Swoole\Process;
|
|
||||||
use Swoole\Runtime;
|
use Swoole\Runtime;
|
||||||
use co;
|
|
||||||
|
|
||||||
|
|
||||||
defined('PID_PATH') or define('PID_PATH', APP_PATH . 'storage/server.pid');
|
defined('PID_PATH') or define('PID_PATH', APP_PATH . 'storage/server.pid');
|
||||||
@@ -184,9 +180,9 @@ class Server extends HttpService
|
|||||||
}
|
}
|
||||||
foreach ($port as $value) {
|
foreach ($port as $value) {
|
||||||
if (Snowflake::isLinux()) {
|
if (Snowflake::isLinux()) {
|
||||||
exec('netstat -tunlp | grep ' . $value['port'], $output);
|
Coroutine\System::exec('netstat -tunlp | grep ' . $value['port'], $output);
|
||||||
} else {
|
} else {
|
||||||
exec('lsof -i :' . $value['port'] . ' | grep -i "LISTEN"', $output);
|
Coroutine\System::exec('lsof -i :' . $value['port'] . ' | grep -i "LISTEN"', $output);
|
||||||
}
|
}
|
||||||
if (!empty($output)) {
|
if (!empty($output)) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user