呕心沥血,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