trash-panda/m2-cron-job-modifier

Disable cron jobs provided by Magento 2 or other modules or move them to other groups

1.0.0 2020-04-17 19:52 UTC

This package is auto-updated.

Last update: 2024-04-18 04:33:57 UTC


README

68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f417964696e48617373616e2f6d322d63726f6e2d6a6f622d6d6f646966792f6d61737465722e7376673f7374796c653d666c61742d737175617265266c6162656c3d4c696e7578

Remove cron jobs or move them to other groups

Installation

$ composer require trash-panda/m2-cron-job-modify
$ php bin/magento setup:upgrade

Usage

You will need to create a module and add a cron_modify.xml file in to the etc directory.

Remove a cron job

To remove a cron job, create a group node and use the name attribute to specify the group. Then specify the jobs to remove using their job codes inside the remove_job node.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:TrashPanda_CronJobModify:etc/cron_modify.xsd">
    <group name="default">
        <remove_job>job_code_1</remove_job>
        <remove_job>job_code_2</remove_job>
    </group>
</config>

Move a cron job in to a different group

This is useful to isolate slow jobs and run them in parallel, or for isolating jobs which can crash, keeping the rest of the jobs running correctly.

To move a cron job, create a group node and use the name attribute to specify the group where the job originally lives. Then specify the jobs to move using their job codes inside the move_job node. Specify the destination group in the to_group attribute.

Note: The destination group must already exist (create it using the default method)

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:TrashPanda_CronJobModify:etc/cron_modify.xsd">
    <group name="default">
        <move_job to_group="my-isolated-group">backend_clean_cache</move_job>
    </group>
</config>