首页 » Nginx » nginx 信号控制

nginx 信号控制

原文 http://blog.csdn.net/shan_zhi_jun/article/details/78979115

2018-01-06 02:01:49阅读(497)

2.nginx 信号控制 2.1 立即关闭进程
    命令:kill -INT 主进程号
    测试:
    [root@bogon nginx]# ps aux|grep nginx
    root      8499  0.0  0.0   3636   552 ?        Ss   04:41   0:00 nginx: master process ./sbin/nginx
    nobody    8500  0.0  0.0   3848   924 ?        S    04:41   0:00 nginx: worker process
    root      9009  0.0  0.0   4356   724 pts/0    S+   04:50   0:00 grep nginx
    [root@bogon nginx]# kill -INT 8499
    [root@bogon nginx]# ps aux|grep nginx
    root      9031  0.0  0.0   4356   724 pts/0    S+   04:55   0:00 grep nginx
2.2 请求结束后再关闭进程
    命令:kill -quit 主进程号 
    测试:
    [root@bogon nginx]# ps aux|grep nginx
    root      9034  0.0  0.0   3636   552 ?        Ss   04:55   0:00 nginx: master process ./sbin/nginx
    nobody    9035  0.0  0.0   3848   924 ?        S    04:55   0:00 nginx: worker process
    root      9038  0.0  0.0   4356   728 pts/0    S+   04:56   0:00 grep nginx
    [root@bogon nginx]# kill -quit 9034
    [root@bogon nginx]# ps aux|grep nginx
    root      9075  0.0  0.0   4356   724 pts/0    S+   05:01   0:00 grep nginx
2.3 改变配置文件,平滑的重读新的配置文件
    命令:kill -hup 主进程号
    测试:
    [root@bogon nginx]# ps aux|grep nginx
    root      9079  0.0  0.0   3636   548 ?        Ss   05:01   0:00 nginx: master process ./sbin/nginx
    nobody    9080  0.0  0.0   3848   920 ?        S    05:01   0:00 nginx: worker process
    root      9083  0.0  0.0   4356   728 pts/0    S+   05:01   0:00 grep nginx
    [root@bogon nginx]# kill -hup 9079
    [root@bogon nginx]# ps aux|grep nginx
    root      9079  0.0  0.1   3780  1156 ?        Ss   05:01   0:00 nginx: master process ./sbin/nginx
    nobody    9085  0.0  0.0   3928  1012 ?        S    05:02   0:00 nginx: worker process
    root      9088  0.0  0.0   4356   724 pts/0    S+   05:02   0:00 grep nginx
2.4 重新启动,并且平滑重新读新的配置文件,不会关闭nginx
    命令:./sbin/nginx -s reload
    测试:
    [root@bogon nginx]# ps aux|grep nginx
    root      2276  0.0  0.0   3636   556 ?        Ss   01:41   0:00 nginx: master process ./sbin/nginx
    nobody    2277  0.0  0.1   3848  1204 ?        S    01:41   0:00 nginx: worker process
    root      2608  0.0  0.0   4356   752 pts/0    S+   02:26   0:00 grep nginx
    [root@bogon nginx]# ./sbin/nginx -s reload
    [root@bogon nginx]# ps aux|grep nginx
    root      2276  0.0  0.1   3780  1164 ?        Ss   01:41   0:00 nginx: master process ./sbin/nginx
    nobody    2611  0.0  0.0   3928  1020 ?        S    02:26   0:00 nginx: worker process
    root      2613  0.0  0.0   4356   752 pts/0    S+   02:26   0:00 grep nginx
2.5 关闭nginx
    命令:./sbin/nginx -s stop
    测试:
    [root@bogon nginx]# ps aux|grep nginx
    root      2276  0.0  0.1   3780  1164 ?        Ss   01:41   0:00 nginx: master process ./sbin/nginx
    nobody    2611  0.0  0.0   3928  1020 ?        S    02:26   0:00 nginx: worker process
    root      2613  0.0  0.0   4356   752 pts/0    S+   02:26   0:00 grep nginx
    [root@bogon nginx]# ./sbin/nginx -s stop
    [root@bogon nginx]# ps aux|grep nginx
    root      2626  0.0  0.0   4356   728 pts/0    S+   02:29   0:00 grep nginx
2.6 重读配置文件
    命令:./sbin/nginx -s reopen
    测试:
    [root@bogon nginx]# ps aux|grep nginx
    root      2669  0.0  0.0   4356   748 pts/0    S+   02:32   0:00 grep nginx
    [root@bogon nginx]# ./sbin/nginx 
    [root@bogon nginx]# ps aux|grep nginx
    root      2671  0.0  0.0   3636   552 ?        Ss   02:32   0:00 nginx: master process ./sbin/nginx
    nobody    2672  0.0  0.0   3848   924 ?        S    02:32   0:00 nginx: worker process
    root      2675  0.0  0.0   4356   748 pts/0    S+   02:33   0:00 grep nginx
    [root@bogon nginx]# ./sbin/nginx -s reopen
    [root@bogon nginx]# ps aux|grep nginx
    root      2671  0.0  0.0   3636   604 ?        Ss   02:32   0:00 nginx: master process ./sbin/nginx
    nobody    2672  0.0  0.0   3848   988 ?        S    02:32   0:00 nginx: worker process
    root      2679  0.0  0.0   4356   724 pts/0    S+   02:33   0:00 grep nginx
2.7 进程结束后退出
    命令:./sbin/nginx -s quit
    测试:
    [root@bogon nginx]# ps aux|grep nginx
    root      2671  0.0  0.0   3636   604 ?        Ss   02:32   0:00 nginx: master process ./sbin/nginx
    nobody    2672  0.0  0.0   3848   988 ?        S    02:32   0:00 nginx: worker process
    root      2679  0.0  0.0   4356   724 pts/0    S+   02:33   0:00 grep nginx
    [root@bogon nginx]# ./sbin/nginx -s quit
    [root@bogon nginx]# ps aux|grep nginx
    root      2758  0.0  0.0   4356   724 pts/0    S+   02:47   0:00 grep nginx

最新发布

CentOS专题

关于本站

5ibc.net旗下博客站精品博文小部分原创、大部分从互联网收集整理。尊重作者版权、传播精品博文,让更多编程爱好者知晓!

小提示

按 Ctrl+D 键,
把本文加入收藏夹