mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 06:58:39 +01:00
keepalived: suppress reloads when config md5 has no change
Signed-off-by: Ben Kelly <ben@benjii.net> Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
committed by
Alexandru Ardelean
parent
0b16c2ada2
commit
8483011a51
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user