mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-04 18:15:29 +02:00
Merge pull request #195 from tve/persistence
Persist mail state directories
This commit is contained in:
commit
5232935d47
2 changed files with 25 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue