vrrp_script chk_haproxy {
script "killall -0 haproxy" # cheaper than pidof
interval 2 # check every 2 seconds
}
But Jessie only have SystemD. [killall] has been remove with SystemV.
You can still use killall5 which is the SystemV killall command.
But killall5 simulates the killall command of SysV UNIX; it sends the given signal to all processes owned by the calling UID. When does it root, it can do very bad things. BE VERY CAREFUL with the killall command on!
# cat /etc/keepalived/keepalived.conf
vrrp_script chk_redis {
script "pidof redis-server" # pidof inside of killall, just to be safe.
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_1 {
interface eth0
state MASTER
virtual_router_id 59
priority 100 # 101 on master, 100 on backup
virtual_ipaddress {
192.168.1.10
}
track_script {
chk_redis
}
}
In my opinion pidof is safer than killall or killall5.
No comments:
Post a Comment