From 8483011a51c94439de53bfbe4c161aee41adc65f Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Tue, 30 Aug 2016 11:54:49 +0300 Subject: [PATCH] keepalived: suppress reloads when config md5 has no change Signed-off-by: Ben Kelly Signed-off-by: Alexandru Ardelean --- net/keepalived/files/keepalived.init | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index 125c087217..6e850f02d8 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -366,9 +366,20 @@ service_running() { pgrep -x /usr/sbin/keepalived &> /dev/null } +conf_md5() { + echo "$(md5sum $KEEPALIVED_CONF | awk '{print $1}')" +} + reload_service() { + local cur_md5="$(conf_md5)" running && { process_config + + # Return without performing the reload if config + # file md5sum has not changed + local new_md5="$(conf_md5)" + [ "$new_md5" == "$cur_md5" ] && return 0; + # SIGHUP is used by keepalived to do init.d reload # Get the oldest process (assumption is that it's the parent process) PID=$(pgrep -o /usr/sbin/keepalived) -- 2.30.2