fix for issue #747 (NOT TESTED YET)
Need to test this. Dont merge it yet.
This commit is contained in:
parent
9145a0a842
commit
6f267cfe4a
|
@ -6,30 +6,30 @@ sleep 5
|
||||||
# change directory
|
# change directory
|
||||||
cd /tmp/docker-mailserver
|
cd /tmp/docker-mailserver
|
||||||
|
|
||||||
# Update / generate after start
|
|
||||||
echo 'Makeing new chksum'
|
|
||||||
sha512sum --tag postfix-accounts.cf --tag postfix-virtual.cf > chksum
|
|
||||||
|
|
||||||
# Run forever
|
|
||||||
while true; do
|
|
||||||
|
|
||||||
# Check postfix-virtual.cf exist else break
|
|
||||||
if [ ! -f postfix-virtual.cf ]; then
|
|
||||||
echo 'postfix-virtual.cf is missing! exit!'
|
|
||||||
break;
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check postfix-accounts.cf exist else break
|
# Check postfix-accounts.cf exist else break
|
||||||
if [ ! -f postfix-accounts.cf ]; then
|
if [ ! -f postfix-accounts.cf ]; then
|
||||||
echo 'postfix-accounts.cf is missing! exit!'
|
echo 'postfix-accounts.cf is missing! This should not run! Exit!'
|
||||||
break;
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update / generate after start
|
||||||
|
echo 'Makeing new chksum'
|
||||||
|
if [ -f postfix-virtual.cf ]; then
|
||||||
|
sha512sum --tag postfix-accounts.cf --tag postfix-virtual.cf > chksum
|
||||||
|
else
|
||||||
|
sha512sum --tag postfix-accounts.cf > chksum
|
||||||
|
fi
|
||||||
|
# Run forever
|
||||||
|
while true; do
|
||||||
|
|
||||||
# Get chksum and check it.
|
# Get chksum and check it.
|
||||||
chksum=$(sha512sum -c chksum)
|
chksum=$(sha512sum -c chksum)
|
||||||
resu_acc=${chksum:21:2}
|
resu_acc=${chksum:21:2}
|
||||||
resu_vir=${chksum:44:2}
|
if [ -f postfix-virtual.cf ]; then
|
||||||
|
resu_vir=${chksum:44:2}
|
||||||
|
else
|
||||||
|
resu_vir="OK"
|
||||||
|
fi
|
||||||
|
|
||||||
if ! [ $resu_acc = "OK" ] || ! [ $resu_vir = "OK" ]; then
|
if ! [ $resu_acc = "OK" ] || ! [ $resu_vir = "OK" ]; then
|
||||||
echo "CHANGE DETECT"
|
echo "CHANGE DETECT"
|
||||||
|
@ -74,6 +74,7 @@ if ! [ $resu_acc = "OK" ] || ! [ $resu_vir = "OK" ]; then
|
||||||
echo ${domain} >> /tmp/vhost.tmp
|
echo ${domain} >> /tmp/vhost.tmp
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
if [ -f postfix-virtual.cf ]; then
|
||||||
# regen postfix aliases
|
# regen postfix aliases
|
||||||
echo -n > /etc/postfix/virtual
|
echo -n > /etc/postfix/virtual
|
||||||
echo -n > /etc/postfix/regexp
|
echo -n > /etc/postfix/regexp
|
||||||
|
@ -97,6 +98,7 @@ if ! [ $resu_acc = "OK" ] || ! [ $resu_vir = "OK" ]; then
|
||||||
s/$/ regexp:\/etc\/postfix\/regexp/
|
s/$/ regexp:\/etc\/postfix\/regexp/
|
||||||
}' /etc/postfix/main.cf
|
}' /etc/postfix/main.cf
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
# Set vhost
|
# Set vhost
|
||||||
if [ -f /tmp/vhost.tmp ]; then
|
if [ -f /tmp/vhost.tmp ]; then
|
||||||
cat /tmp/vhost.tmp | sort | uniq > /etc/postfix/vhost && rm /tmp/vhost.tmp
|
cat /tmp/vhost.tmp | sort | uniq > /etc/postfix/vhost && rm /tmp/vhost.tmp
|
||||||
|
@ -116,7 +118,11 @@ if ! [ $resu_acc = "OK" ] || ! [ $resu_vir = "OK" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'Update chksum'
|
echo 'Update chksum'
|
||||||
|
if [ -f postfix-virtual.cf ]; then
|
||||||
sha512sum --tag postfix-accounts.cf --tag postfix-virtual.cf > chksum
|
sha512sum --tag postfix-accounts.cf --tag postfix-virtual.cf > chksum
|
||||||
|
else
|
||||||
|
sha512sum --tag postfix-accounts.cf > chksum
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
Loading…
Reference in New Issue