From 4ae2a8641f82796513952c5b78ce6b131ea5730f Mon Sep 17 00:00:00 2001 From: ofreax Date: Sat, 27 Aug 2016 10:37:00 +0200 Subject: [PATCH] finish script --- image/service/keepalived/finish.sh | 13 +++++++++++++ image/service/keepalived/startup.sh | 6 ++++++ 2 files changed, 19 insertions(+) create mode 100755 image/service/keepalived/finish.sh diff --git a/image/service/keepalived/finish.sh b/image/service/keepalived/finish.sh new file mode 100755 index 0000000..9d1280a --- /dev/null +++ b/image/service/keepalived/finish.sh @@ -0,0 +1,13 @@ +#!/bin/bash -e + +# set -x (bash debug) if log level is trace +# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/log-helper +log-helper level eq trace && set -x + +# try to delete virtual ips from interface +for vip in $(complex-bash-env iterate KEEPALIVED_VIRTUAL_IPS) +do + ip addr del ${vip}/32 dev ${KEEPALIVED_INTERFACE} || true +done + +exit 0 diff --git a/image/service/keepalived/startup.sh b/image/service/keepalived/startup.sh index 51206db..387f969 100755 --- a/image/service/keepalived/startup.sh +++ b/image/service/keepalived/startup.sh @@ -39,6 +39,12 @@ if [ ! -e "$FIRST_START_DONE" ]; then touch $FIRST_START_DONE fi +# try to delete virtual ips from interface +for vip in $(complex-bash-env iterate KEEPALIVED_VIRTUAL_IPS) +do + ip addr del ${vip}/32 dev ${KEEPALIVED_INTERFACE} || true +done + if [ ! -e "/etc/backup-manager.conf" ]; then ln -sf ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf /etc/keepalived/keepalived.conf fi