Scheduled Tasks Monitor

User Guide for the Shopware 6 Plugin for Monitoring Scheduled Tasks

Introduction

This plugin for Shopware 6 provides comprehensive monitoring functions for scheduled tasks. It automatically detects and notifies you via email when scheduled tasks are not executed or problems occur. The plugin can automatically restart failed or pending tasks and offers flexible configuration options to ensure that critical processes run smoothly.

Configuration Options

After installing the plugin via the Shopware Store, you can make the following settings in the plugin configuration:

General Settings

Notification Email Addresses

  • Setting: email

  • Description: Here you can enter one or more email addresses to which notifications should be sent. Separate multiple email addresses with commas. Leave this field empty to disable notifications.

  • Example: admin@example.com, support@example.com

Enable Automatic Task Status Repair

  • Setting: enableTaskStatusUpdate

  • Description: Enable or disable automatic update of the task status to "scheduled" after notification.

  • Default value: true

Enable Scheduled Task (instead of Command / System Cronjob)

  • Setting: enableScheduledTask

  • Description: Enable or disable the scheduled task to perform monitoring. Alternatively, you can register a system cronjob to run the command bin/console fgits:scheduler:run-checks.

  • Default value: true

Grace Period for Missed Task Runs (in seconds)

  • Setting: executionThreshold

  • Description: Tasks that are stuck longer than this time will be automatically restarted.

  • Default value: 7200 (2 hours)

Ignored Task Names

  • Setting: ignoredTaskNames

  • Description: Enter the names of tasks to be ignored, separated by commas.

  • Example: taskName1, taskName2

Plugin Logic

The plugin monitors the scheduled tasks and checks whether a task requires attention. The following logic is applied:

When is a Task Considered?

  1. Not considered:

    • If the task status is SKIPPED or INACTIVE.

  2. Considered:

    • If the task status is FAILED.

    • If the task status is QUEUED or RUNNING and the task remains in this status longer than the specified grace period (executionThreshold).

    • If the task has exceeded its scheduled execution date by more than the specified grace period.

Plugin Execution

The plugin can optionally be operated via the included Scheduled Task or via the Shopware command bin/console fgits:scheduler:run-checks.

Recommendation for System Cronjob

To ensure that notifications are sent even if the scheduler has completely failed, we recommend setting up the command as a system cronjob and running it at least every 15 minutes.

Example Cron Expression

To run the command bin/console fgits:scheduler:run-checks every 15 minutes, add the following line to your crontab:

*/15 * * * * /path/to/shopware/bin/console fgits:scheduler:run-checks

Replace /path/to/shopware/ with the actual path to your Shopware installation.

With these configuration options and settings, you can ensure that all scheduled tasks in your Shopware 6 installation are reliably monitored and you are notified immediately if problems occur.

Was this helpful?