Magento 2 - How to disable cronjob temporarily
-
26-02-2021 - |
Domanda
I have a crojob in my custom module and want to disable it temporarily
The xml files for the cronjob are:
app/code/Vendor/Module/etc/cron_groups.xml
app/code/Vendor/Module/etc/crontab.xml
I have tried to comment out the code fro cron scheduling
<?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="my_cron_id">
<!--<job name="my_cron_name" instance="Vendor\Module\Cron\MyCron" method="execute">
<schedule>0 3 * * *</schedule>
</job>-->
</group>
</config>
But after this, my module went stopped working with no error.
I just simply wants to disable it temporarily how can I do this?
Soluzione
I think if you have only one cronjob in your crontab.xml file and you want to remove it, you should rename your file to be _crontab.xml and clear the cache.
Altri suggerimenti
You can run the cron command cron:remove
.
Reference
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange