From d9662e76ba8d9257cb1c2917b562f0b11608d46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Mon, 11 May 2020 12:54:17 +0200 Subject: [PATCH] Fix and improve cron jobs in doc * Do not run commands as root when it is not needed * Remove commands which are part of modoboa-stats --- doc/manual_installation/modoboa.rst | 43 +++++++++++++---------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/doc/manual_installation/modoboa.rst b/doc/manual_installation/modoboa.rst index f9e5fe63a..40a3c1e40 100644 --- a/doc/manual_installation/modoboa.rst +++ b/doc/manual_installation/modoboa.rst @@ -200,35 +200,30 @@ A few recurring jobs must be configured to make Modoboa works as expected. Create a new file, for example :file:`/etc/cron.d/modoboa` and put the -following content inside:: +following content inside: - # - # Modoboa specific cron jobs - # - PYTHON= - INSTANCE= +.. sourcecode:: bash - # Operations on mailboxes - * * * * * vmail $PYTHON $INSTANCE/manage.py handle_mailbox_operations + # + # Modoboa specific cron jobs + # + PYTHON= + INSTANCE= - # Sessions table cleanup - 0 0 * * * root $PYTHON $INSTANCE/manage.py clearsessions + # Operations on mailboxes + * * * * * vmail $PYTHON $INSTANCE/manage.py handle_mailbox_operations - # Logs table cleanup - 0 0 * * * root $PYTHON $INSTANCE/manage.py cleanlogs + # Generate DKIM keys (they will belong to the user running this job) + * * * * * root umask 077 && $PYTHON $INSTANCE/manage.py modo manage_dkim_keys - # Logs parsing - */5 * * * * root $PYTHON $INSTANCE/manage.py logparser &> /dev/null - 0 * * * * root $PYTHON $INSTANCE/manage.py update_statistics - - # DNSBL checks - */30 * * * * root $PYTHON $INSTANCE/manage.py modo check_mx - - # Public API communication - 0 * * * * root $PYTHON $INSTANCE/manage.py communicate_with_public_api - - # Generate DKIM keys (they will belong to the user running this job) - * * * * * root umask 077 && $PYTHON $INSTANCE/manage.py modo manage_dkim_keys + # Sessions table cleanup + 0 0 * * * modoboa $PYTHON $INSTANCE/manage.py clearsessions + # Logs table cleanup + 0 0 * * * modoboa $PYTHON $INSTANCE/manage.py cleanlogs + # DNSBL checks + */30 * * * * modoboa $PYTHON $INSTANCE/manage.py modo check_mx + # Public API communication + 0 * * * * modoboa $PYTHON $INSTANCE/manage.py communicate_with_public_api Now you can continue to the :ref:`webserver` section.