banner

Scheduled Jobs Plugin

img

Scheduled Jobs Plugin Documentation

CronSchedulerBundle is a Mautic plugin that provides a centralized way to schedule, manage, and monitor Mautic console commands directly from the Mautic user interface. Instead of relying solely on system-level cron definitions scattered across servers, this plugin allows administrators to define and control scheduled jobs from within Mautic itself.

A key goal of the plugin is to simplify operational management. Teams can configure when commands should run, trigger them manually when necessary, and inspect execution results without logging into the server or manually running CLI commands.

The plugin supports three flexible scheduling strategies:

  • Date-based execution – run a job once at a specific date and time.
  • Interval-based execution – run a job repeatedly at a fixed interval such as every few minutes, hours, or days.
  • Cron expression–based execution – run jobs using standard cron syntax for advanced scheduling scenarios.

Each execution attempt is recorded in a persistent log, capturing metadata such as start time, completion time, duration, exit code, command output, and error details. These logs are available both in the job detail view and in a navbar dropdown showing the most recent executions, making it easy to quickly inspect job activity.

The plugin works by registering a single system cron entry that periodically triggers a scheduler command. This command scans the database for jobs that are due to run, executes them safely with concurrency protection, records execution logs, and calculates the next scheduled run.

By consolidating scheduling logic into Mautic, CronSchedulerBundle improves operational visibility, debugging, and control over background tasks that are essential for maintaining and automating marketing workflows.


Installation & Setup

Prerequisites

Before installing and using the CronScheduler Plugin, ensure that your environment meets the following requirements.

Supported Mautic Versions:

The plugin is compatible with the following versions of Mautic:

  • Mautic 4.x
  • Mautic 5.x
  • Mautic 6.x
  • Mautic 7.x

Make sure your Mautic instance is installed and functioning correctly before installing the plugin.

Composer Dependency

The plugin relies on the cron expression parser library to evaluate cron schedules and calculate the next execution time for scheduled jobs which contains Cron Notation.

Install the required dependency in your Mautic project:

composer require dragonmantank/cron-expression

Installation Steps

Unzip the plugin into the Mautic plugins directory.

The plugin will be placed in:

plugins/CronSchedulerBundle

Clear cache and run bin/console m:a:g

Now scheduled jobs should be available at the admin panel along with a dropdown at navbar beside notifications.


Scheduled Jobs Functionality

The CronScheduler Plugin allows administrators to Create, View, Update, and Delete (CRUD) scheduled jobs directly from the Mautic user interface. Each scheduled job represents a Symfony console command that will be executed according to a configured schedule.

Navigate to the Admin Panel→ Scheduled Jobs to access the job management interface.

From this section, you can:

  • Create new scheduled jobs
  • View existing job configurations
  • Edit job schedules or commands
  • Delete jobs that are no longer needed
  • Manually trigger jobs for immediate execution

Each job definition includes the command to run, optional arguments, scheduling configuration, and metadata such as the last execution time and next scheduled run.

Field Description
Name Label of the job we create
Command List of commands generated dynamically, which are available in the application
Trigger Mode Cron notation, specific date/time, or dynamic trigger (e.g., run every 5 minutes, daily, or weekends)
Arguments Some commands require arguments. For example: --campaign-ids=11,19

The plugin supports three different scheduling methods, allowing flexible control over how and when jobs are execute

1. Date & Time Based Jobs

This option allows you to schedule a job to run once at a specific date and time.

This scheduling mode is useful for tasks that only need to run a single time, such as:

  • Data migration tasks
  • One-time maintenance scripts
  • Manual system operations scheduled for a future time

When configuring a job using this method:

  1. Select Date as the trigger mode.
  2. Specify the exact date and time when the job should run.
  3. Save the job configuration.

Once the job executes successfully, it will not be scheduled again because it is designed as a one-time execution.

2. Interval Based Jobs

Interval scheduling allows a job to run repeatedly at fixed intervals such as every few minutes, hours, or days.

This method is useful for tasks that need to run periodically but do not require complex cron expressions.

Examples include:

  • Running a command every 15 minutes
  • Running a job every 2 hours
  • Executing a cleanup task once per day


When configuring an interval-based job:

  1. Select Trigger for Every as the trigger mode.
  2. Enter the interval value (numeric value).
  3. Select the interval unit, such as:
    • Minutes
    • Hours
    • Days
  4. Optionally specify a trigger hour or restrict execution to certain days of the week.

After each execution, the scheduler automatically calculates the next run time based on the configured interval.


3. Cron Notation Based Jobs

For advanced scheduling scenarios, the plugin supports cron expression-based scheduling.

Cron notation allows highly flexible scheduling patterns using the standard cron format.

Examples:

Cron Description
*/5 * * * * Run every 5 minutes
0 * * * * Run at the start of every hour
0 0 * * * Run once every day at midnight
0 9 * * 1 Run every Monday at 9 AM

When configuring a cron-based job:

  1. Select Cron Notation as the trigger mode.
  2. Enter the cron expression in the cron notation field.
  3. Save the job.

The plugin uses a cron parsing library to validate the expression and calculate the next execution time automatically.

Priority-Based Execution

Each job can have a priority value assigned to it. When multiple jobs are due to run at the same time, the scheduler executes them in order of priority.

Higher priority jobs are executed first, ensuring that critical background tasks are processed before less important ones.

Manual Job Execution

In addition to automatic scheduling, administrators can also trigger jobs manually from the Scheduled Jobs interface.

When the Trigger button is clicked:

  1. The scheduler immediately executes the selected command.
  2. The execution result is recorded in the job execution logs.
  3. A success or error message is displayed in the UI.

Manual execution is useful for testing job configurations or running commands on demand without waiting for the next scheduled run.

Managing Existing Jobs

Once a job has been created, it appears in the Scheduled Jobs list view where administrators can:

  • View job details
  • Modify scheduling settings
  • Enable or disable the job
  • Delete the job
  • Trigger the job manually

Each job record also displays metadata such as:

  • Last execution time
  • Next scheduled run
  • Job status
  • Associated execution logs

This centralized management interface makes it easy to monitor and control background tasks running within the system.

 

Execution Logs

Every time a scheduled job runs, the plugin records detailed execution logs.

Each log entry stores:

  • Job name
  • Execution start time
  • Completion time
  • Execution duration
  • Exit code
  • Command output
  • Error message (if any)

These logs can be viewed:

  • In the job detail page
  • Through the recent execution logs dropdown in the navigation bar

This provides visibility into background tasks and helps diagnose issues when commands fail.

Automatic Log Cleanup

To prevent the database from growing excessively due to execution logs, the plugin includes a maintenance command that automatically removes older logs and which also comes with the plugin itself.

The number of days that logs should be retained can be configured in the application settings under Cron Scheduler configuration and by default it holds for 25 days.

The cleanup happens automatically for every 25 days by default and we can modify it through configuration if we want to remove it earlier to save DB.

Working of the Plugin

The CronScheduler Plugin centralizes the scheduling and execution of console commands within the application. Instead of managing multiple system cron entries on the server, administrators can define jobs from the UI and allow the scheduler to determine when they should run.

The plugin works through a combination of scheduled job definitions, a scheduler service, and a single cron trigger command that periodically evaluates and executes due jobs.

By running mautic:jobs: trigger command alone can fetch all the created scheduled jobs and queue them to run based on the time interval.

Default Jobs on Plugin Installation

When the plugin is installed, it automatically creates a set of default scheduled jobs required for core application background processing. This is handled by the plugin’s installation subscriber.

During installation, the system checks whether these jobs already exist. If they do not, the plugin automatically creates them.

The default jobs include:

Job Command Schedule
Segment Rebuild mautic:segments:update Every 15 minutes
Campaign Update mautic:campaigns:update Every 15 minutes (offset)
Campaign Trigger mautic:campaigns:trigger Every 15 minutes (offset)

These jobs ensure that important background processes, such as segment rebuilding and campaign processing, run automatically without requiring manual configuration.

Version

V4.x, V5.x, V6.x, V7.x

There are no reviews yet.

Add a Review
Comment
Your rating
Original price was: ₹600.00.Current price is: ₹250.00.

CronSchedulerBundle lets you schedule and manage Mautic commands directly from the UI without server-level cron

  • Downloads:
    44
  • Released On:
    16 February 2021
  • Version:
    1.0
  • Compatibility:
    Mautic v4.x, v5.x, v6.x, v7.x
  • Powered by
    Topchunks