4

I have created a crontab in my custom module and scheduled at every 10 minutes. It is working fine, when I am running the "php bin/magento setup:upgrade" command.

So, first time it is working fine, in cron_schedule table, status = success and message = null. which is fine. but, after 10 minutes this cron is not working.

Having status = error and message = "No callbacks found". I have debugged the code and found that in second time cron "instance" is not being set.

Can anyone help me on this? Why there is no instance in second time?

Thank you.

Here is my crontab.xml code:

<?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="index">
    <job name="cron_setup_job" instance="Vendor\Module\Cron\ClassName" method="execute">
        <schedule>*/10 * * * *</schedule>
    </job>
</group>
</config>
6
  • 1
    can you add your code? Dec 10, 2018 at 13:48
  • I have added my code in the question, please review it. Dec 11, 2018 at 4:52
  • Your cron schedule expression is wrong. To execute every 10 minutes, use */10 * * * * as schedule value. With your expression it will execute every 0 minutes, means every hour Dec 11, 2018 at 4:57
  • @JaiminSutariya Sorry, Initially it was "*/10 * * * *", but after that I have changed it to 1 hour. As per my question I have updated my cron schedule. Dec 11, 2018 at 5:01
  • If it executes first time successfully, it should execute the second time. If you can provide your error log, it will be helpful to debug the issue. Dec 11, 2018 at 5:13

1 Answer 1

1

Finally, My cron job is working fine. I don't know what was the issue with my crontab.xml and cron class file. But, I have deleted my files and copied and pasted core module's files in my module and renamed them. This time I have changed job name, and it is working fine for me. Now, I don't have "No callbacks found" error anymore. If anyone has such error/issue, advice to use core module's crontab.xml file in your module and do needful changes. It will work fine. Most Important: Need to set <group id="default"> Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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