From 144428c52bb93990855ce64fa2706b45b8dcfcdc Mon Sep 17 00:00:00 2001 From: "promptless[bot]" Date: Wed, 6 May 2026 10:33:56 +0000 Subject: [PATCH] Document --cleanup-only flag for mautic:reports:scheduler command Add documentation for the new --cleanup-only flag that allows users to run report cleanup separately from report sending, preventing duplicate Report Emails when both operations run simultaneously. --- docs/configuration/cron_jobs.rst | 34 +++++++++++++++++++++++++++++--- docs/reports/reports.rst | 8 ++++++-- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/docs/configuration/cron_jobs.rst b/docs/configuration/cron_jobs.rst index 26ab7063..6f555527 100644 --- a/docs/configuration/cron_jobs.rst +++ b/docs/configuration/cron_jobs.rst @@ -274,6 +274,8 @@ Command parameters: - ``--min-contact-id`` and ``--max-contact-id`` allows the separation of Email sending by smaller chunks, by specifying contact ID ranges. If those ranges won't overlap, this allows you to run several broadcast commands in parallel. +.. _send scheduled reports cron job: + .. vale off Send scheduled Reports cron job @@ -285,11 +287,37 @@ Starting with Mautic 2.12.0, it's now possible to use cron to send scheduled Rep .. code-block:: php - php /path/to/mautic/bin/console mautic:reports:scheduler [--report=ID] + php /path/to/mautic/bin/console mautic:reports:scheduler [--report=ID] [--cleanup-only] -.. note:: +Command parameters: +******************* + +- ``--report=ID`` specifies a Report by ID. If not provided, processes all scheduled Reports. + +- ``--cleanup-only`` runs only the cleanup operation, removing old exported Report files without sending scheduled Reports. Use this to separate the cleanup and sending tasks to prevent duplicate Report Emails. + +.. note:: + + For releases prior to 1.1.3, it's required to append ``--env=prod`` to the cron job command to ensure commands execute correctly. + +Preventing duplicate Report Emails +********************************** + +Running the Report send and cleanup operations at the same time can cause duplicate Report Emails. To prevent this, run separate cron jobs: + +1. A cleanup-only job that removes old exported files: + + .. code-block:: php + + php /path/to/mautic/bin/console mautic:reports:scheduler --cleanup-only + +2. A separate job that sends scheduled Reports: + + .. code-block:: php + + php /path/to/mautic/bin/console mautic:reports:scheduler - for releases prior to 1.1.3, it's required to append ``--env=prod`` to the cron job command to ensure commands execute correctly. +Stagger these jobs so they don't run at the same time. .. vale off diff --git a/docs/reports/reports.rst b/docs/reports/reports.rst index fc065d69..df0b34c5 100644 --- a/docs/reports/reports.rst +++ b/docs/reports/reports.rst @@ -177,9 +177,13 @@ Cron job to schedule Reports Mautic requires the following cron command to be able to send scheduled Reports: -``php /path/to/mautic/bin/console mautic:reports:scheduler [--report=ID]`` +``php /path/to/mautic/bin/console mautic:reports:scheduler [--report=ID] [--cleanup-only]`` -The ``--report=ID`` argument allows you to specify a Report by ID if required. For more information, see :ref:`Cron jobs`. +- The ``--report=ID`` argument allows you to specify a Report by ID if required. + +- The ``--cleanup-only`` argument runs only the cleanup operation to remove old exported files without sending Reports. + +For more information, see :ref:`Send scheduled Reports cron job`. Report options ==============