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

你可能感兴趣的文章
npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
查看>>
npm版本过高问题
查看>>
npm的“--force“和“--legacy-peer-deps“参数
查看>>
npm的安装和更新---npm工作笔记002
查看>>
npm的常用配置项---npm工作笔记004
查看>>
npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
查看>>
npm编译报错You may need an additional loader to handle the result of these loaders
查看>>
npm设置淘宝镜像、升级等
查看>>
npm设置源地址,npm官方地址
查看>>
npm配置安装最新淘宝镜像,旧镜像会errror
查看>>
NPM酷库052:sax,按流解析XML
查看>>
npm错误 gyp错误 vs版本不对 msvs_version不兼容
查看>>
npm错误Error: Cannot find module ‘postcss-loader‘
查看>>
npm,yarn,cnpm 的区别
查看>>
NPOI之Excel——合并单元格、设置样式、输入公式
查看>>
NPOI初级教程
查看>>
NPOI利用多任务模式分批写入多个Excel
查看>>
NPOI在Excel中插入图片
查看>>
NPOI将某个程序段耗时插入Excel
查看>>
NPOI格式设置
查看>>