From 908011fc1d49a8a113581795e1556430f2e34927 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 7 Apr 2021 17:01:59 +0200 Subject: [PATCH] fix: [rsync-backup-target] force restart when config changed Signed-off-by: Valentin Lab --- rsync-backup-target/hooks/init | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rsync-backup-target/hooks/init b/rsync-backup-target/hooks/init index 04fee963..dacc0df5 100755 --- a/rsync-backup-target/hooks/init +++ b/rsync-backup-target/hooks/init @@ -47,9 +47,19 @@ while read-0 ident key; do keys["$key"]="$ident" done < <(echo "$keys" | shyaml key-values-0) +debug "Adding config hash to enable recreating upon config change." +config_hash=$({ + ## XXXvlab: ``env -i`` sole purpose is to protect find + ## against big shell environments, and prevent it to fail. + env -i find "${host_path_key}" \ + -name \*.pub -exec md5sum {} \; + } | md5_compat) || exit 1 + init-config-add "\ $SERVICE_NAME: volumes: - $host_path_key:$local_path_key:ro + labels: + - compose.config_hash=$config_hash "