From 6fbd1967d13f18fc6825e7a7426cf17df40b30d4 Mon Sep 17 00:00:00 2001 From: Casper Date: Fri, 16 Apr 2021 11:26:51 +0200 Subject: [PATCH] Backup script improved (#1912) --- docs/content/faq.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/content/faq.md b/docs/content/faq.md index b5e91d20..7112b554 100644 --- a/docs/content/faq.md +++ b/docs/content/faq.md @@ -54,17 +54,21 @@ Please do not use `CRLF`. ### What about backups? -Assuming that you use `docker-compose` and a data volumes, you can backup your user mails like this: +Assuming that you use `docker-compose` and data volumes, you can backup the configuration, emails and logs like this: ```sh +# create backup docker run --rm -ti \ -v maildata:/var/mail \ -v mailstate:/var/mail-state \ + -v maillogs:/var/logs/mail \ + -v "$PWD/config":/tmp/docker-mailserver \ -v /backup/mail:/backup \ - alpine:3.2 \ - tar czf "/backup/mail-$(date +%y%m%d-%H%M%S).tgz" /var/mail /var/mail-state + alpine:latest \ + tar czf "/backup/mail-$(date +%F).tar.gz" /var/mail /var/mail-state /var/logs/mail /tmp/docker-mailserver -find /backup/mail -type f -mtime +30 -exec rm -f {} \; +# delete backups older than 30 days +find /backup/mail -type f -mtime +30 -delete ``` ### What about `mail-state` folder?