Detecting switch off nginx keepalived

Nginx detection port to enable closed keepalived 

Nginx detection process; then close keepalived, close drift IP;

cat nginx_pid.sh

#!/bin/bash while true do if [ $(netstat -tlnp|grep nginx|wc -l) -ne 1 ] then systemctl stop keepalived fi sleep 2 done

Such detection is only closed; or manually switched to standby machine starts;

 The grep process nginx is determined that there is not a name of; to stop; so other scripts If nginx process will lead to a named judge does not come out.

Port port can be replaced, the more unique.

netstat -tlnp|grep 443|wc -l

The detection of the presence or absence on the sole.

 

Guess you like

Origin www.cnblogs.com/sharesdk/p/11141825.html