mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2024-12-14 10:52:49 +02:00
[Dovecot] Imapsync: Set is_running = 0 on restart
This commit is contained in:
parent
dbaddc562e
commit
4a403e9323
@ -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 \
|
||||||
|
@ -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 "$@"
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user