1

I've written a custom module and the module has to run every Wednesday at 07:10. I've written a cron job and in the schedule. Below is the code added in crontab.xml

<?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="Vendorname_Modulename"> 
    <job name="Vendorname_Modulename" instance="Netelixir\ProductFeed\Cron\Testcron" method="execute">
        <schedule>00-10 7 * * 3</schedule>
    </job>
 </group>
 </config>

The cron job is not working as expected. The cron is working only when it's scheduled to run every minute or 5 minutes or 30 minutes. But not at a particular time. Can anyone help me with this scenario?

1 Answer 1

0

First, check the status in the cron_schedule table and take the necessary action.

SELECT * FROM `cron_schedule` WHERE `job_code` = 'your_cron_job_name'

Also, your schedule will be run on At every minute from 0 through 10 past hour 7 on Wednesday. So it will be run 10 times from 2021-07-21 07:00:00 to 2021-07-21 07:10:00.

enter image description here

To run At 07:10 on Wednesday, we need to use 10 7 * * 3

enter image description here

Please check this link to test the schedule.

6
  • Thanks for the response. I want the cron to run from 0 to 10 mins at 7 on Wednesday. But it's still not working. Jul 14, 2021 at 11:25
  • what is the status of the job on the cron table? Jul 14, 2021 at 11:44
  • There are no entries for that job at that time. Jul 14, 2021 at 12:03
  • It is probably due to time zone difference and time mismatch. Jul 14, 2021 at 12:06
  • I've scheduled the cron job as per the server time stamp. Jul 14, 2021 at 12:20

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.