博客
关于我
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/

你可能感兴趣的文章
ORACEL学习--理解over()函数
查看>>
ORACLE Bug 4431215 引发的血案—原因分析篇
查看>>
oracle dblink 创建使用 垮库转移数据
查看>>
oracle dblink结合同义词的用法 PLS-00352:无法访问另一数据库
查看>>
Oracle dbms_job.submit参数错误导致问题(ora-12011 无法执行1作业)
查看>>
oracle dg switchover,DG Switchover fails
查看>>
Oracle EBS环境下查找数据源(OAF篇)
查看>>
Oracle GoldenGate Director安装和配置(无图)
查看>>
oracle script
查看>>
Oracle select表要带双引号的原因
查看>>
Oracle SOA Suit Adapter
查看>>
Oracle Spatial空间数据库建立
查看>>
UML— 活动图
查看>>
Oracle Statspack分析报告详解(一)
查看>>
oracle where 条件的执行顺序分析1
查看>>
oracle 使用leading, use_nl, rownum调优
查看>>
Oracle 写存储过程的一个模板还有一些基本的知识点
查看>>
Oracle 创建 DBLink 的方法
查看>>
oracle 创建字段自增长——两种实现方式汇总
查看>>
Oracle 升级10.2.0.5.4 OPatch 报错Patch 12419392 Optional component(s) missing 解决方法
查看>>