mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
consolidate mail state to fix #191
This commit is contained in:
parent
c8169c0a34
commit
4ca39f9144
2
Makefile
2
Makefile
|
@ -19,11 +19,13 @@ run:
|
|||
docker run -d --name mail \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test":/tmp/docker-mailserver-test \
|
||||
-v "`pwd`/test/onedir":/var/mail-state \
|
||||
-e SA_TAG=1.0 \
|
||||
-e SA_TAG2=2.0 \
|
||||
-e SA_KILL=3.0 \
|
||||
-e SASL_PASSWD=testing \
|
||||
-e ENABLE_MANAGESIEVE=1 \
|
||||
-e ONE_DIR=1 \
|
||||
-h mail.my-domain.com -t $(NAME)
|
||||
sleep 20
|
||||
docker run -d --name mail_pop3 \
|
||||
|
|
|
@ -268,6 +268,29 @@ test -z "$ENABLE_FAIL2BAN" && rm -f /etc/logrotate.d/fail2ban
|
|||
# Fix cron.daily for spamassassin
|
||||
sed -i -e 's/invoke-rc.d spamassassin reload/\/etc\/init\.d\/spamassassin reload/g' /etc/cron.daily/spamassassin
|
||||
|
||||
# Consolidate all state that should be persisted across container restarts into one mounted
|
||||
# directory
|
||||
statedir=/var/mail-state
|
||||
if [ "$ONE_DIR" = 1 -a -d $statedir ]; then
|
||||
echo "Consolidating all state onto $statedir"
|
||||
for d in /var/spool/postfix /var/lib/postfix /var/lib/amavis /var/lib/clamav /var/lib/spamassasin /var/lib/fail2ban; do
|
||||
dest=$statedir/`echo $d | sed -e 's/.var.//; s/\//-/g'`
|
||||
if [ -d $dest ]; then
|
||||
echo " Destination $dest exists, linking $d to it"
|
||||
rm -rf $d
|
||||
ln -s $dest $d
|
||||
elif [ -d $d ]; then
|
||||
echo " Moving contents of $d to $dest:" `ls $d`
|
||||
mv $d $dest
|
||||
ln -s $dest $d
|
||||
else
|
||||
echo " Linking $d to $dest"
|
||||
mkdir -p $dest
|
||||
ln -s $dest $d
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Starting daemons"
|
||||
cron
|
||||
/etc/init.d/rsyslog start
|
||||
|
|
Loading…
Reference in a new issue