I need to override a crontab.xml from:


    <job name="expired_tokens_cleanup" instance="Magento\Integration\Cron\CleanExpiredTokens" method="execute">
        <schedule>0 * * * *</schedule>


    <job name="expired_tokens_cleanup" instance="Magento\Integration\Cron\CleanExpiredTokens" method="execute">
        <schedule>*/15 * * * *</schedule>

The question is... Which is the best way to do it?

I have already created a file in the path app/design/frontend/[Vendor]/[theme]/Magento_Integration/etc/crontab.xml but nothing change.



do same entry into core_config_data with same cron expression, it will override that.


You should create an extension having etc/crontab.xml file

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job name="expired_tokens_cleanup" instance="Magento\Integration\Cron\CleanExpiredTokens" method="execute">
        <schedule>*/15 * * * *</schedule>

This should work.


Most hosting use a crontab file somewhere where you can put your settings in. If you are using a hosting you should ask them where and how you can adjust it. Because the cron is executed server side this is the only way to do that.

If you want to adjust the settings in the backend how Magento generates cron tasks (this is for generating cron tasks , not executing them) you have 2 options.

1. Manually

Adjust them manually under Stores->Settings->Configuration->Advanced->System

2. By module

Create a module and use a etc/config.xml to set the default settings of those fields. Remember that a user can always overwrite them manually.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">

You can find all available fields under vendor/magento/module-cron/etc/adminhtml/system.xml


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.