From 1d79439834de5052f9defca4d0d4b9f57621eff4 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 16 Dec 2024 15:35:12 +0100 Subject: [PATCH] keepalived: only add content to config file if needed Only add the first two pieces of information to the configuration file if there is a valid '/etc/config/keepalived'. Signed-off-by: Florian Eckert --- net/keepalived/files/keepalived.init | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index c017a679f8..20535a4b54 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -600,11 +600,6 @@ process_config() { local alt_config_file linkbeat_use_polling rm -f "$KEEPALIVED_CONF" - - # First line - printf '! Configuration file for keepalived (autogenerated via init script)\n' > "$KEEPALIVED_CONF" - printf '! Written %s\n\n' "$(date +'%c')" >> "$KEEPALIVED_CONF" - [ -f /etc/config/keepalived ] || return 0 config_load 'keepalived' config_get alt_config_file globals alt_config_file @@ -617,6 +612,10 @@ process_config() { return 0 } + # First line + printf '! Configuration file for keepalived (autogenerated via init script)\n' > "$KEEPALIVED_CONF" + printf '! Written %s\n\n' "$(date +'%c')" >> "$KEEPALIVED_CONF" + config_get_bool linkbeat_use_polling globals linkbeat_use_polling 0 [ "$linkbeat_use_polling" -gt 0 ] && printf 'linkbeat_use_polling\n\n' >> "$KEEPALIVED_CONF" -- 2.30.2