Some changes.
This commit is contained in:
parent
d582d9cee9
commit
6ab23cc562
|
@ -1,13 +1,28 @@
|
|||
#! /bin/bash
|
||||
|
||||
|
||||
while ! [ $ENABLE_LDAP = 1 ]; do
|
||||
while true; do
|
||||
|
||||
cd /tmp/docker-mailserver
|
||||
chksum=$(sha512sum -c chksum)
|
||||
resu_acc=${chksum:21:2}
|
||||
resu_vir=${chksum:44:2}
|
||||
|
||||
# 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
|
||||
if [ ! -f postfix-accounts.cf ]; then
|
||||
echo 'postfix-accounts.cf is missing! exit!'
|
||||
break;
|
||||
fi
|
||||
|
||||
# Check chksum exist else create
|
||||
if [ ! -f chksum ]; then
|
||||
sha512sum --tag postfix-accounts.cf --tag postfix-virtual.cf > chksum
|
||||
fi
|
||||
|
||||
if ! [ $resu_acc = "OK" ] || ! [ $resu_vir = "OK" ]; then
|
||||
echo "CHANGE DETECT"
|
||||
echo -n > /etc/postfix/vmailbox
|
||||
|
@ -50,16 +65,21 @@ if ! [ $resu_acc = "OK" ] || ! [ $resu_vir = "OK" ]; then
|
|||
echo ${domain} >> /tmp/vhost.tmp
|
||||
done
|
||||
fi
|
||||
|
||||
# Set vhost
|
||||
if [ -f /tmp/vhost.tmp ]; then
|
||||
cat /tmp/vhost.tmp | sort | uniq > /etc/postfix/vhost && rm /tmp/vhost.tmp
|
||||
fi
|
||||
|
||||
# Set right new if needed
|
||||
if [ `find /var/mail -maxdepth 3 -a \( \! -user 5000 -o \! -group 5000 \) | grep -c .` != 0 ]; then
|
||||
chown -R 5000:5000 /var/mail
|
||||
fi
|
||||
|
||||
postfix reload
|
||||
dovecot reload
|
||||
supervisorctl restart postfix
|
||||
supervisorctl restart dovecot
|
||||
sha512sum --tag postfix-accounts.cf --tag postfix-virtual.cf > chksum
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
|
|
|
@ -183,7 +183,10 @@ function register_functions() {
|
|||
if [ "$ENABLE_CLAMAV" = 1 ]; then
|
||||
_register_start_daemon "_start_daemons_clamav"
|
||||
fi
|
||||
|
||||
# Change detector
|
||||
if [ "$ENABLE_LDAP" = 0 ]; then
|
||||
_register_start_daemon "_start_changedetector"
|
||||
fi
|
||||
|
||||
_register_start_daemon "_start_daemons_amavis"
|
||||
################### << daemon funcs
|
||||
|
@ -1247,7 +1250,10 @@ function _start_daemons_amavis() {
|
|||
# Start check for update postfix-accounts and postfix-virtual
|
||||
##########################################################################
|
||||
|
||||
nohup /usr/local/bin/check_for_changes.sh >/dev/null 2>&1 &
|
||||
function _start_changedetector() {
|
||||
notify 'task' 'Starting changedetector' 'n'
|
||||
supervisorctl start changedetector
|
||||
}
|
||||
|
||||
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
|
|
@ -114,3 +114,10 @@ stdout_logfile=/var/log/supervisor/%(program_name)s.log
|
|||
stderr_logfile=/var/log/supervisor/%(program_name)s.log
|
||||
command=/usr/local/bin/postfix-wrapper.sh
|
||||
|
||||
[program:changedetector]
|
||||
startsecs=0
|
||||
autostart=false
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/supervisor/%(program_name)s.log
|
||||
stderr_logfile=/var/log/supervisor/%(program_name)s.log
|
||||
command=/usr/local/bin/check_for_changes.sh
|
||||
|
|
Loading…
Reference in New Issue