I'm running keepalived under Debian (Lenny, Squeeze) in a fairly simple setup, I'm just (ab)using it as a VRRP daemon to decide the mastership between two equal machines for some virtual IPs. All the magic happens in the notify-script.
When I completely stop the daemon (using debian's init-script) keepalived does not run the notify-script for backup or at least fault mode, which is what I would suspect and need.
I could "fix" the rc-script with some unwanted effects - the notify-script would be hard-coded into the rc-script introducing an unwanted coupling of these two and the mess of porting the patch to the next debian versions so this is not the way I really want to go...
Any hints for a cleaner solution to this problem?
vrrp_instance FOORRP {
virtual_router_id 42
interface eth0
state BACKUP
priority 200
nopreempt
authentication {
auth_type AH
auth_pass foobar42
}
notify "/usr/local/bin/vrrp-state"
virtual_ipaddress {
127.0.0.2
}
}
PS: the use of the "three notify_"-scripts does not change anything
PPS: in the changelog (Release 1.1.16) there is something mentioned, that somehow fits my problem (though I am not using anything lvs-related in keepalived), but I am using a newer version (1.1.20): "notify_down isn't executed for working real servers on keepalived shutdown."
Dug through more documentation and finally found it:
Works as expected.... X-}
I faced such an issue recently and I found it is logical to not execute these scripts. These scripts get executed in case of specific events like becoming a master or slave. Keepalived process should not be shutdown unless it is done manually and there is a good reason to do so. If you are worried about failure in keepalived process (not the case of manually shutting it down), you can use monit. It is a great tool to monitor your running processes and restart them if anyone fails.
As you mentioned, you can simply modify the startup script of keepalived to execute the desired script (like stopping some other service). I think this will be cleaner than patching keepalived code, maintaining it yourself, and doing the necessary patch again each time you want to re-install/upgrade it.