4

I need to override a crontab.xml from:

vendor/magento/module-integration/etc/crontab.xml

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

To

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

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.

Greetings.

0

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 System->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">
    <default>
        <cron>
            <template>
                <schedule_generate_every>500</schedule_generate_every>
.....
            </template>
        </cron>
</config>

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

0

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

0

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>
    </job>
    </group>
</config>

This should work.

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.