hyperf框架常用命令-在centos7中退出命令及在docker容器中退出命令
今天有的群里的同学问了一些这种问题,我就抽时间操作了一下并记录一下
手册很重要,基础更重要啊
一.centos7中的退出命令
1.退出hyperf
ctrl + c
2.查看hyperf启动占用端口
netstat -anp | grep 9501
[[email protected] ~]# netstat -anp | grep 9501
tcp 0 0 0.0.0.0:9501 0.0.0.0:* LISTEN 13365/skeleton.Mast
tcp 0 0 192.168.1.98:9501 192.168.1.38:40808 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40826 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40864 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40870 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40794 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40834 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40842 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40798 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40824 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40844 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40812 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40860 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40852 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40858 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40850 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40832 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40856 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40800 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40810 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40848 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40788 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40818 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40840 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40838 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40816 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40790 TIME_WAIT -
tcp 0 0 192.168.1.98:9501 192.168.1.38:40804 TIME_WAIT -
3.杀掉hyperf启动占用的端口 如上界面的 13365
kill -9 13365
4.退出hyperf命令行模式 并在后台运行
直接叉掉远程连接的xshell界面 假如你是用这个的话 哈哈
二.docker容器中的退出命令
1.查看容器id
[[email protected] ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1a0005f6e0db 80070f1f0c8f "docker-entrypoint.s…" 2 months ago Up 2 months 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp rabbitmq
be8cf8bd2a78 goblog "bee run" 3 months ago Up 3 months 0.0.0.0:8080->8080/tcp goblogbeego
103fd0f26448 hyperf/hyperf:7.4-alpine-v3.11-swoole "/bin/sh" 6 months ago Up 43 minutes 0.0.0.0:9601->9601/tcp hyperf
2.进入已经启动运行中的容器中
docker exec -it 103fd0f26448 /bin/sh
[[email protected] ~]# docker exec -it 103fd0f26448 /bin/sh
/ # ls -a
. .dockerenv data etc lib mnt proc run srv tmp var
.. bin dev home media opt root sbin sys usr
/ # cd data/project/
/data/project # ls
Dockerfile app composer.json config phpstan.neon public runtime test
README.md bin composer.lock deploy.test.yml phpunit.xml push.sh storage vendor
/data/project # netstat -anp | grep 9601
tcp 0 0 0.0.0.0:9601 0.0.0.0:* LISTEN 49/skeleton.Master
/data/project # kill -9 49
/data/project # php bin/hyperf.php start
/data/project # php bin/hyperf.php start
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Paginator\Listener\PageResolverListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ExceptionHandlerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\DbConnection\Listener\RegisterConnectionResolverListener listener.
[DEBUG] Event Hyperf\Framework\Event\BeforeMainServerStart handled by Hyperf\Amqp\Listener\BeforeMainServerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\BeforeMainServerStart handled by Hyperf\Task\Listener\InitServerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BeforeMainServerStart handled by Hyperf\Process\Listener\BootProcessListener listener.
[DEBUG] Event Hyperf\Framework\Event\OnStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[INFO] TaskWorker#2 started.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\WebSocketServer\Listener\InitSenderListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Task\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[INFO] TaskWorker#3 started.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\WebSocketServer\Listener\InitSenderListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Task\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[INFO] TaskWorker#4 started.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\WebSocketServer\Listener\InitSenderListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Task\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[INFO] TaskWorker#5 started.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\WebSocketServer\Listener\InitSenderListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Task\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[DEBUG] Event Hyperf\Framework\Event\MainWorkerStart handled by Hyperf\Amqp\Listener\MainWorkerStartListener listener.
[INFO] Worker#0 started.
[INFO] WebSocket Server listening at 0.0.0.0:9602
[INFO] HTTP Server listening at 0.0.0.0:9601
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\WebSocketServer\Listener\InitSenderListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Task\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[DEBUG] Event Hyperf\Framework\Event\OnManagerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[INFO] Worker#1 started.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\WebSocketServer\Listener\InitSenderListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Task\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[DEBUG] Crontab Foo have been registered.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Crontab\Listener\CrontabRegisterListener listener.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[INFO] Process[queue.default.0] start.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Process\Listener\LogBeforeProcessStartListener listener.
3.退出容器进入本机 并且在后台运行
ctrl + p + q
备注:按住ctrl 键 在继续按p键 在继续按q键
出现以下信息:
...
[INFO] Process[queue.default.0] start.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Process\Listener\LogBeforeProcessStartListener listener.
read escape sequence
[[email protected] ~]#
这样就退出容器中hyperf的命令行模式 并且在后台运行 一并退出容器进入本机了
相关文章