0

Cron Job is not working. Below is crontab.xml file:

<?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 instance="Vendor\Module\Cron\Run" method="execute" name="OrdSendMail">
            <schedule>*/5 * * * *</schedule>
        </job>
    </group>
</config>
1
  • Code seems ok. what Check rest of file
    – Amit Bera
    Commented Feb 5, 2020 at 6:06

1 Answer 1

0

for some reason after upgrade from 2.3.3 to 2.3.4 cron stopped working All files and configurations were OK. So after many cups of coffee. This is what it worked for me

A) remove the Magento crontab:

  • Log in as or switch to the Magento file system owner.
  • Change to the Magento installation directory.
  • Enter the following command:

    $ bin/magento cron:remove B) Change to the /var directory.

    Remove the following files:

    .setup_cronjob_status
    .update_cronjob_status

any other file related to cron in this folder

C) So far magento now, does not have any cron job available nor any file attached to it

Now we create a new Magento crontab:

$ bin/magento cache:flush $ bin/magento cron:install [Note you can use -f or --force but since we deleted is not necessary]

Now we check $ crontab -l

It should show like

MAGENTO START c5f9e5ed71cceaabc4d4fd9b3e827a2b * * * * * /usr/bin/php /var/www/html/magento2/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/html/magento2/var/log/magento.cron.log * * * * * /usr/bin/php /var/www/html/magento2/update/cron.php >> /var/www/html/magento2/var/log/update.cron.log * * * * * /usr/bin/php /var/www/html/magento2/bin/magento setup:cron:run >> /var/www/html/magento2/var/log/setup.cron.log

MAGENTO END c5f9e5ed71cceaabc4d4fd9b3e827a2b

And now we run cron

$bin/magento cron:run

Now for those who do not like or does not have experience checking DB Tables (cron_schedule) table

The easiest way is goring to backend of magento

Admin->System->Index Management

It should be SET as UPDATE BY SCHEDULE and READY

If it works just Refresh the page 1 minute later and the Updated Date and time should change

Good Luck

PS: part was taking from here

Your Answer

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

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