[Dovecot] Imapsync: Set is_running = 0 on restart

master
André 2018-06-03 19:22:44 +02:00
parent dbaddc562e
commit 4a403e9323
3 changed files with 12 additions and 1 deletions

View File

@ -56,6 +56,7 @@ RUN apt-get update && apt-get -y --no-install-recommends install \
liburi-perl \ liburi-perl \
lzma-dev \ lzma-dev \
make \ make \
mysql-client \
procps \ procps \
supervisor \ supervisor \
cron \ cron \

View File

@ -1,6 +1,12 @@
#!/bin/bash #!/bin/bash
set -e set -e
# Wait for MySQL to warm-up
while ! mysqladmin ping --host mysql -u${DBUSER} -p${DBPASS} --silent; do
echo "Waiting for database to come up..."
sleep 2
done
# Hard-code env vars to imapsync due to cron not passing them to the perl script # Hard-code env vars to imapsync due to cron not passing them to the perl script
sed -i "/^\$DBUSER/c\\\$DBUSER='${DBUSER}';" /usr/local/bin/imapsync_cron.pl sed -i "/^\$DBUSER/c\\\$DBUSER='${DBUSER}';" /usr/local/bin/imapsync_cron.pl
sed -i "/^\$DBPASS/c\\\$DBPASS='${DBPASS}';" /usr/local/bin/imapsync_cron.pl sed -i "/^\$DBPASS/c\\\$DBPASS='${DBPASS}';" /usr/local/bin/imapsync_cron.pl
@ -123,4 +129,8 @@ touch /etc/crontab /etc/cron.*/*
# Clean old PID if any # Clean old PID if any
[[ -f /usr/local/var/run/dovecot/master.pid ]] && rm /usr/local/var/run/dovecot/master.pid [[ -f /usr/local/var/run/dovecot/master.pid ]] && rm /usr/local/var/run/dovecot/master.pid
# Clean stopped imapsync jobs
IMAPSYNC_TABLE=$(mysql -h mysql-mailcow -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "SHOW TABLES LIKE 'imapsync'" -Bs)
[[ ! -z ${IMAPSYNC_TABLE} ]] && mysql -h mysql-mailcow -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "UPDATE imapsync SET is_running='0'"
exec "$@" exec "$@"

View File

@ -167,7 +167,7 @@ services:
- sogo - sogo
dovecot-mailcow: dovecot-mailcow:
image: mailcow/dovecot:1.26 image: mailcow/dovecot:1.27
build: ./data/Dockerfiles/dovecot build: ./data/Dockerfiles/dovecot
cap_add: cap_add:
- NET_BIND_SERVICE - NET_BIND_SERVICE