add
This commit is contained in:
18
2-生产环境4.0/负载均衡服务器/高负载均衡/nginx_check.sh
Normal file
18
2-生产环境4.0/负载均衡服务器/高负载均衡/nginx_check.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
log_file=/etc/keepalived/report.log
|
||||
COUNT=$(systemctl status nginx | grep -c "active (running)")
|
||||
|
||||
|
||||
if [ "$COUNT" -eq 0 ];then
|
||||
|
||||
echo "[ERROR] moniter nginx failure ! $(date) " >> ${log_file}
|
||||
systemctl restart nginx
|
||||
|
||||
sleep 2
|
||||
if [ $(systemctl status nginx | grep -c "active (running)") -eq 0 ];then
|
||||
echo "[ERROR] restart nginx failed ! $(date) " >> ${log_file}
|
||||
killall keepalived
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user