From 2fe1ef89f9caf0cea38f9a70436e0aa1422a3169 Mon Sep 17 00:00:00 2001 From: acaranta Date: Mon, 5 Dec 2022 11:15:20 +0100 Subject: [PATCH] Corrected changes detection --- inotifreload.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/inotifreload.sh b/inotifreload.sh index 1aee0aa..bec2c10 100755 --- a/inotifreload.sh +++ b/inotifreload.sh @@ -45,9 +45,16 @@ while true; do do if [[ -f /hacfg/$item || -d /hacfg/$item ]]; then #Check if initial sync is needed - if [ ! -d /etc/haproxy/$item ]; then - rsync -ad /hacfg/$item /etc/haproxy --delete - fi + if [[ -d $PASSED ]]; then + if [ ! -d /etc/haproxy/$item ]; then + rsync -ad /hacfg/$item /etc/haproxy --delete + fi + elif [[ -f $PASSED ]]; then + if [ ! -f /etc/haproxy/$item ]; then + rsync -ad /hacfg/$item /etc/haproxy --delete + fi + fi + #Check for difference diff /hacfg/$item /etc/haproxy/$item 2>&1 >/dev/null