2

I've written a custom module and this module has to run every day at 12:30 AM. I've written a cron job and in the schedule I've update as follows:

<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="daily_report" instance="mymodule\Mail\Cron\SendEmail" method="execute">
            <schedule>30 00 * * *</schedule>
        </job>
    </group>
</config>

Apparently this job is not running. I can't see any entries in cron_schedule schedule table as well.

When I change the schedule to every minute, this job is working fine. What am I doing wrong?

3
  • I think you should remove one zero, so change it to <schedule>30 0 * * *</schedule> Nov 29, 2017 at 15:46
  • i have same problem Aug 30, 2018 at 9:26
  • <job name="vendor_module_reminder_email" instance="vendor\module\Cron\ReminderEmail" method="execute"> <schedule>0 0 * * *</schedule> </job> Aug 30, 2018 at 9:27

1 Answer 1

2

In my case, the mistake was that I expected the cron job to get scheduled according to my server time. Apparently, the scheduler uses the store time and not the server time.

That is if your schedule is 30 0 * * *, it will run every day at 00:30 by the store time. You can check your current store time by placing an order and checking it's creation time in the admin panel.

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.