2

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>
  • 1
    can you add your code? – PMB Dec 10 '18 at 13:48
  • I have added my code in the question, please review it. – Ronak Parmar Dec 11 '18 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 – Jaimin Sutariya Dec 11 '18 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. – Ronak Parmar Dec 11 '18 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. – Jaimin Sutariya Dec 11 '18 at 5:13
0

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, privacy policy and cookie policy

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