From e99bba2ef52ea74ea31c10621cdc4b9a2fdb4625 Mon Sep 17 00:00:00 2001 From: JiLleON <28780165+JiLleON@users.noreply.github.com> Date: Tue, 2 Aug 2022 15:38:22 +0400 Subject: [PATCH] docs: Improve cron tasks and fix link in documentation (#2708) Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com> --- .../config/advanced/full-text-search.md | 38 +++++++++++++++++++ docs/content/config/environment.md | 2 +- docs/content/faq.md | 14 ++++--- 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/docs/content/config/advanced/full-text-search.md b/docs/content/config/advanced/full-text-search.md index f1cf103a..efd21d23 100644 --- a/docs/content/config/advanced/full-text-search.md +++ b/docs/content/config/advanced/full-text-search.md @@ -103,6 +103,42 @@ While indexing is memory intensive, you can configure the plugin to limit the am ``` docker-compose exec mailserver doveadm fts optimize -A ``` + Or like the [Spamassassin example][docs-faq-sa-learn-cron] shows, you can instead use `cron` from within `docker-mailserver` to avoid potential errors if the mail-server is not running: + +??? example + + Create a _system_ cron file: + + ```sh + # in the docker-compose.yml root directory + mkdir -p ./docker-data/dms/cron # if you didn't have this folder before + touch ./docker-data/dms/cron/fts_xapian + chown root:root ./docker-data/dms/cron/fts_xapian + chmod 0644 ./docker-data/dms/cron/fts_xapian + ``` + + Edit the system cron file `nano ./docker-data/dms/cron/fts_xapian`, and set an appropriate configuration: + + ```conf + # Adding `MAILTO=""` prevents cron emailing notifications of the task outcome each run + MAILTO="" + # + # m h dom mon dow user command + # + # Everyday 4:00AM, optimize index files + 0 4 * * * root doveadm fts optimize -A + ``` + + Then with `docker-compose.yml`: + + ```yaml + services: + mailserver: + image: docker.io/mailserver/docker-mailserver:latest + volumes: + - ./docker-data/dms/cron/fts_xapian:/etc/cron.d/fts_xapian + ``` + ### Solr @@ -153,3 +189,5 @@ However, Solr also requires a fair bit of RAM. While Solr is [highly tuneable](h #### Further Discussion See [#905](https://github.com/docker-mailserver/docker-mailserver/issues/905) + +[docs-faq-sa-learn-cron]: ../../faq.md#how-can-i-make-spamassassin-better-recognize-spam diff --git a/docs/content/config/environment.md b/docs/content/config/environment.md index 600c334c..e89603e4 100644 --- a/docs/content/config/environment.md +++ b/docs/content/config/environment.md @@ -759,7 +759,7 @@ you to replace both instead of just the envelope sender. - **empty** => no default - password for default relay user -[docs-faq-onedir]: ../faq.md#what-is-the-mail-state-folder-for +[docs-faq-onedir]: ../faq.md#what-about-docker-datadmsmail-state-folder-varmail-state-internally [docs-tls]: ./security/ssl.md [docs-tls-letsencrypt]: ./security/ssl.md#lets-encrypt-recommended [docs-tls-manual]: ./security/ssl.md#bring-your-own-certificates diff --git a/docs/content/faq.md b/docs/content/faq.md index a4419971..09ef6c4c 100644 --- a/docs/content/faq.md +++ b/docs/content/faq.md @@ -184,23 +184,25 @@ The following configuration works nicely: # This assumes you're having `environment: ONE_DIR=1` in the env-mailserver, # with a consolidated config in `/var/mail-state` # + # '> /dev/null' to send error notifications from 'stderr' to 'postmaster@example.com' + # # m h dom mon dow user command # # Everyday 2:00AM, learn spam from a specific user # spam: junk directory - 0 2 * * * root sa-learn --spam /var/mail/example.com/username/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin + 0 2 * * * root sa-learn --spam /var/mail/example.com/username/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin > /dev/null # ham: archive directories - 15 2 * * * root sa-learn --ham /var/mail/example.com/username/.Archive* --dbpath /var/mail-state/lib-amavis/.spamassassin + 15 2 * * * root sa-learn --ham /var/mail/example.com/username/.Archive* --dbpath /var/mail-state/lib-amavis/.spamassassin > /dev/null # ham: inbox subdirectories - 30 2 * * * root sa-learn --ham /var/mail/example.com/username/cur* --dbpath /var/mail-state/lib-amavis/.spamassassin + 30 2 * * * root sa-learn --ham /var/mail/example.com/username/cur* --dbpath /var/mail-state/lib-amavis/.spamassassin > /dev/null # # Everyday 3:00AM, learn spam from all users of a domain # spam: junk directory - 0 3 * * * root sa-learn --spam /var/mail/not-example.com/*/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin + 0 3 * * * root sa-learn --spam /var/mail/not-example.com/*/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin > /dev/null # ham: archive directories - 15 3 * * * root sa-learn --ham /var/mail/not-example.com/*/.Archive* --dbpath /var/mail-state/lib-amavis/.spamassassin + 15 3 * * * root sa-learn --ham /var/mail/not-example.com/*/.Archive* --dbpath /var/mail-state/lib-amavis/.spamassassin > /dev/null # ham: inbox subdirectories - 30 3 * * * root sa-learn --ham /var/mail/not-example.com/*/cur* --dbpath /var/mail-state/lib-amavis/.spamassassin + 30 3 * * * root sa-learn --ham /var/mail/not-example.com/*/cur* --dbpath /var/mail-state/lib-amavis/.spamassassin > /dev/null ``` Then with `docker-compose.yml`: