From 9eaf9b048d044d7f3d9f077dc77afcd63a6a25ac Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Thu, 4 Feb 2021 14:36:24 +0100 Subject: [PATCH] fix: [cron] force restart when schedule command are changed Signed-off-by: Valentin Lab --- cron/hooks/pre_deploy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 cron/hooks/pre_deploy diff --git a/cron/hooks/pre_deploy b/cron/hooks/pre_deploy new file mode 100755 index 00000000..23bc254c --- /dev/null +++ b/cron/hooks/pre_deploy @@ -0,0 +1,20 @@ +#!/bin/bash +## Should be executable N time in a row with same result. + +set -e + +cron_config_hash() { + debug "Adding config hash to enable recreating upon config change." + config_hash=$({ + find "$SERVICE_CONFIGSTORE/etc/cron"{,.hourly,.weekly,.daily,.monthly} \ + -type f -exec md5sum {} \; + } | md5_compat) || exit 1 + init-config-add " +$MASTER_BASE_SERVICE_NAME: + labels: + - compose.config_hash=$config_hash +" +} + + +cron_config_hash || exit 1