Files
zeaslity 437acbeb63 add
2024-10-30 16:30:51 +08:00

19 lines
433 B
Bash

#!/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