shell脚本监测Nginx服务运行状态

环境准备
准备一台Centos6服务器
系统: Centos6.8
内存:1G
cpu: 2核
IP地址: 10.0.0.21
# 创建shell脚本
vim check_nginx.sh 
#!/bin/bash
NUM=`netstat -ntl |grep -w 80 | wc -l`
if [ $NUM -eq 0 ];then
  echo "Nginx已经停止运行"
else
  echo "Nginx状态正常..."
fi
# 执行脚本
sh check_nginx.sh 
发布了68 篇原创文章 · 获赞 24 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/aaronszm/article/details/103756727
今日推荐