我有一个根本不会触发的vrrp_script。 下面是conf:
VRRP Conf
vrrp_script chk_health {
script "/usr/local/health.sh"
interval 2 # check every 2 seconds
fall 2 # require 2 failures for KO
rise 2 # require 2 successes for OK
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 61
priority 151
advert_int 1
authentication {
auth_type PASS
auth_pass mypass
}
track_script {
chk_health
}
virtual_ipaddress {
172.31.254.31
}
}
Health.sh
#!/bin/bash
echo "script started" >> /tmp/keep.log
if ! pgrep -x "mysqld"
then
return 2;
fi
if ! pgrep -x "nginx"
then
return 3;
fi
return 0;
理想情况下,我应该在temp文件夹中获取日志,但事实并非如此。 脚本未执行。但是,如果我添加内联代码,则它可以工作。