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

你可能感兴趣的文章
OpenVP共用账号 一个账号多台电脑登录
查看>>
OpenVSwtich(OVS)Vlan间路由实战 附实验环境
查看>>
Openwrt LuCI模块练习详细步骤
查看>>
openwrt_git_pull命令提示merger冲突时如何解决?
查看>>
OpenWrt包管理软件opkg的使用(极路由)
查看>>
OpenWrt固件编译刷机完全总结
查看>>
Open××× for Linux搭建之二
查看>>
Open×××有线网络时使用正常,无线网络时使用报错的解决方案
查看>>
Opera Mobile Classic Emulator
查看>>
Operation not supported on read-only collection 的解决方法 - [Windows Phone开发技巧系列1]
查看>>
OperationResult
查看>>
Operations Manager 2007 R2系列之仪表板(多)视图
查看>>
operator new and delete
查看>>
operator new 与 operator delete
查看>>
operator() error
查看>>
OPPO K3在哪里打开USB调试模式的完美方法
查看>>
oppo后端16连问
查看>>
Optional类:避免NullPointerException
查看>>
Optional讲解
查看>>
ORA-00932: inconsistent datatypes: expected - got NCLOB【ORA-00932: 数据类型不一致: 应为 -, 但却获得 NCLOB 】【解决办法】
查看>>