启动Nginx
- ps -ef | grep nginx 管道过滤实例进程
#! /usr/bin/bash
nginx_process_num=$(ps -ef | grep nginx | grep -v grep | wc -l)
# 判断进程是否存在,不存在就启动Nginx
if [ $nginx_process_num -eq 0 ]; then
systemctl start nginx
fi
#! /usr/bin/bash
nginx_process_num=$(ps -ef | grep nginx | grep -v grep | wc -l)
# 判断进程是否存在,不存在就启动Nginx
if [ $nginx_process_num -eq 0 ]; then
systemctl start nginx
fi
本文标题:9、Shell检查Nginx是否启动
本文链接:https://www.haomeiwen.com/subject/wykhwctx.html
网友评论