I have a crojob in my custom module and want to disable it temporarily

The xml files for the cronjob are:


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>


But after this, my module went stopped working with no error.

I just simply wants to disable it temporarily how can I do this?


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.

  • I renamed both xml files with _. I hope I would find proper solution for this, but for now it resolved the issue. Thanks for helping :) – Shoaib Munir Apr 17 '19 at 5:46
  • 1
    i had the similar issue with events.xml file. I had only one event and i tried to comment that, which causes magento to showing me error as when magento is reading xml, it expects atleast one element or else it stops working. – Yash Shah Apr 17 '19 at 5:59

You can run the cron command cron:remove.

  • Thanks for the answer, but it will remove all the cronjobs of magento, not just my custom cronjob – Shoaib Munir Apr 17 '19 at 5:04

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.