From 311bdfa1ba5828debd0e298aca07a2057facd37d Mon Sep 17 00:00:00 2001 From: Erik Wramner Date: Tue, 30 Jul 2019 15:03:36 +0200 Subject: [PATCH] Keep checksum file outside shared/mounted area --- target/check-for-changes.sh | 12 ++++++++---- test/config/chksum | 2 -- 2 files changed, 8 insertions(+), 6 deletions(-) delete mode 100644 test/config/chksum diff --git a/target/check-for-changes.sh b/target/check-for-changes.sh index d16aefc3..74de345c 100755 --- a/target/check-for-changes.sh +++ b/target/check-for-changes.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash # create date for log output log_date=$(date +"%Y-%m-%d %H:%M:%S ") @@ -6,6 +6,10 @@ log_date=$(date +"%Y-%m-%d %H:%M:%S ") sleep 5 echo "${log_date} Start check-for-changes script." +# create work area outside mounted directory +mkdir -p /tmp/docker-mailserver-work +CHKSUM_FILE=/tmp/docker-mailserver-work/chksum + # change directory cd /tmp/docker-mailserver @@ -33,7 +37,7 @@ done # Update / generate after start echo "${log_date} Makeing new checksum file." -sha512sum ${cf_files[@]/#/--tag } > chksum +sha512sum ${cf_files[@]/#/--tag } >$CHKSUM_FILE # Run forever while true; do @@ -42,7 +46,7 @@ while true; do log_date=$(date +"%Y-%m-%d %H:%M:%S ") # Get chksum and check it. -chksum=$(sha512sum -c --ignore-missing chksum) +chksum=$(sha512sum -c --ignore-missing $CHKSUM_FILE) if [[ $chksum == *"FAIL"* ]]; then echo "${log_date} Change detected" @@ -187,7 +191,7 @@ if [[ $chksum == *"FAIL"* ]]; then fi echo "${log_date} Update checksum" - sha512sum ${cf_files[@]/#/--tag } > chksum + sha512sum ${cf_files[@]/#/--tag } >$CHKSUM_FILE fi sleep 1 diff --git a/test/config/chksum b/test/config/chksum deleted file mode 100644 index c5fd3a96..00000000 --- a/test/config/chksum +++ /dev/null @@ -1,2 +0,0 @@ -SHA512 (postfix-accounts.cf) = 8eba4eedb76e8c3b740ca4eea5d7ad1c8695fd7fd39d3e5d161201101b5b63a1c1471ab85bd79d6ed4ba192c423275a3d1210a9596a06904434ab5707ad3753b -SHA512 (postfix-virtual.cf) = c5bff9b5c50886a72a559ee52b1230b751c3820cd12de3ffe2a632f8d2a7845fa33ddac397c62889f0680d096be24418f22c1b81fb93ad56fd4937869f16954b