Keep checksum file outside shared/mounted area

This commit is contained in:
Erik Wramner 2019-07-30 15:03:36 +02:00
parent f849b46462
commit 311bdfa1ba
2 changed files with 8 additions and 6 deletions

View file

@ -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

View file

@ -1,2 +0,0 @@
SHA512 (postfix-accounts.cf) = 8eba4eedb76e8c3b740ca4eea5d7ad1c8695fd7fd39d3e5d161201101b5b63a1c1471ab85bd79d6ed4ba192c423275a3d1210a9596a06904434ab5707ad3753b
SHA512 (postfix-virtual.cf) = c5bff9b5c50886a72a559ee52b1230b751c3820cd12de3ffe2a632f8d2a7845fa33ddac397c62889f0680d096be24418f22c1b81fb93ad56fd4937869f16954b