博客
关于我
Nginx学习笔记3:Shell脚本检测Nginx服务状态
阅读量:218 次
发布时间:2019-02-28

本文共 1348 字,大约阅读时间需要 4 分钟。

Nginx ???????????

??

???????Nginx ????????????????????????????????Nginx ????????????????????????????????Nginx ??????????????????


??

A=$(ps -C nginx --no-header | wc -l)if [ $A -eq 0 ]; then    /usr/local/nginx/sbin/nginx    sleep 2    if [ `ps -C nginx --no-header | wc -l` -eq 0 ]; then        killall keepalived    fifi

????

1. ps -C nginx --no-header

ps -C nginx --no-header ?????????????Nginx ?????????-C ?????????????nginx ????????--no-header ??????????????????

?????

[root@bogon ~]# ps -C nginx --no-header4983 ?        00:00:00 nginx4984 ?        00:00:00 nginx

?????

  • 4983 ? 4984 ???Nginx ?????????? PID?
  • ? ???????00:00:00 ??????
  • nginx ??????

?????

  • ps -C nginx ? ps -ef | grep nginx ???-C ??????????????????
  • ?? ps -C ??????? grep ?????????

2. wc -l

wc -l ??????????? ps ???ps -C nginx --no-header | wc -l ?????Nginx ??????

???

[root@bogon ~]# ps -C nginx --no-header | wc -l2

???????? 0???Nginx ???????????? 0???????????


????

1. ??????

  • ??Nginx ??????????? ps -C nginx --no-header | wc -l ??Nginx ?????
  • ?????????????? 0??????????? /usr/local/nginx/sbin/nginx ?????
  • ?????????????????????????????? 0??????????????? killall keepalived ???Nginx??????? keepalived??

2. ????

???????????????????????????

  • Apache ???? nginx ??? apache?
  • MySQL ???? nginx ??? mysql?
  • ?????????????????????

??

???????????????Nginx ????????????Nginx????????????????????????

转载地址:http://hzxi.baihongyu.com/

你可能感兴趣的文章
OceanBase 安装使用详细说明
查看>>
OceanBase详解及如何通过MySQL的lib库进行连接
查看>>
ocp最新题库之052新题带答案整理-36题
查看>>
OCP题库升级,新版的052考试题及答案整理-18
查看>>
OCR:文字识别(最详细教程)
查看>>
OCR使用总结
查看>>
OCR识别:身份证信息加密传输
查看>>
octave错误-error: ‘squareThisNumber‘ undefined near line 1 column 1
查看>>
Octotree Chrome插件离线安装
查看>>
OCTO作为美团的高性能服务通信框架,究竟能不能称得上是杀手锏呢?
查看>>
OC中关于给NSString 赋 nil和@""的区别
查看>>
OC字符串方法汇总
查看>>
OC学习6——面相对象的三大特性
查看>>
OC点语法介绍和使用以及@property关键字
查看>>
oc知道经纬度求位置
查看>>
OC高效率52之提供“全能初始化”方法
查看>>
oc--习题
查看>>
oday!POC管理和漏洞扫描小工具
查看>>
ODBC的JAR包和PLSQL
查看>>
ODE网络:一场颠覆RNN的革命即将到来
查看>>