系统相关
首页 > 系统相关> > 呕心沥血,nginx自动重启脚本唯一值

呕心沥血,nginx自动重启脚本唯一值

作者:互联网

呕心沥血,nginx自动重启脚本唯一值

#!/bin/bash
while true
do
A=`systemctl status nginx.service|grep running|awk '{print $3}'|tr -d '[\(\)]'`
if [ -z "$A" -a "$A" != "running" ];then
echo $(date +%F%n%T) "nginx1.18不健康需要重启nginx..."
/usr/bin/systemctl restart nginx.service
sleep 10
else
echo $(date +%F%n%T) "nginx1.18正在运行健康状态running..."
fi
sleep 10
done

标签:bin,service,重启,echo,nginx,running,呕心沥血
来源: https://www.cnblogs.com/capable/p/14960501.html