cancel
Showing results for 
Search instead for 
Did you mean: 

Should the Magento cron jobs update the index when set to "Update By Schedule"?

Should the Magento cron jobs update the index when set to "Update By Schedule"?

I have set index management to "Update By Schedule" but the index is not getting updated. I have the three required Magento cron jobs set and running every minute.

7 REPLIES 7

Re: Should the Magento cron jobs update the index when set to "Update By Schedule"?

Like in Magento 1.x, in Magento 2 each module has its own internal cron schedule, and its cron jobs are executed according to the internal schedule, not for every cron run.

An example of the external schedule: https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Catalog/etc/crontab.xml#L11

 

Re: Should the Magento cron jobs update the index when set to "Update By Schedule"?

Thanks for the info... didn't remember that. BUT the last time my index was updated was 13 days ago which I am quite certain is plenty of time for it to have indexed by now. What else could it be?


@Dmitry_Fedyuk wrote:

Like in Magento 1.x, in Magento 2 each module has its own internal cron schedule, and its cron jobs are executed according to the internal schedule, not for every cron run.

An example of the external schedule: https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Catalog/etc/crontab.xml#L11

 


 

Re: Should the Magento cron jobs update the index when set to "Update By Schedule"?

Maybe your cron command is incorrect. 

My working example is here: https://mage2.pro/t/32

Expecially take notice of the operating system account which is used for the cron job: it should have enough permissions for the job.

Re: Should the Magento cron jobs update the index when set to "Update By Schedule"?

Here's the cron that I'm using. I have run each of these commands from the command line manually and they appear to be working. Since I have multiple versions of php installed I had to reference the full path of php...

* * * * * /opt/rh/rh-php56/root/usr/bin/php -c /home/example/etc/php.ini /home/example/public_html/bin/magento cron:run
* * * * * /opt/rh/rh-php56/root/usr/bin/php -c /home/example/etc/php.ini /home/example/public_html/update/cron.php
* * * * * /opt/rh/rh-php56/root/usr/bin/php -c /home/example/etc/php.ini /home/example/public_html/bin/magento setup:cron:run

I also have tried running a test php file in cron with these same commands and it was executing properly, but I'm not seeing my indexer getting updated in Magento even though I have it set to "Update By Schedule". In fact, even when I set it to "Update on Save" and then save a product it doesn't update the index. Smiley Sad

Re: Should the Magento cron jobs update the index when set to "Update By Schedule"?

Can anyone debug my cron in the previous post or give more input? Does it require a manual update of the index on the command line before the "Update By Schedule" or "Update On Save" work via cron?

Re: Should the Magento cron jobs update the index when set to "Update By Schedule"?

Your cron cmd are indeed set-up correctly and as-per manual.

 

However, it doesn't work. Won't index, schedule or any of that stuff. But nobody is going to tell you that! We've tried on various platforms (3) already and all seemed to bug on the re-indexing schedule... amojng other things. For the index the workaround is to add an standalone/additional cron for it

 

e.g.
xxxxx -c /home/example/etc/php.ini /home/example/public_html/bin/magento indexer:reindex

 

I've just installed these on my server here, works flawlessly:

> -c /home/example/etc/php.ini /home/example/public_html/bin/magento uninstall:literally

> -c /home/example/etc/php.ini /home/example/public_html/bin/magento delete:everything 

> -c /home/example/etc/php.ini /home/example/public_html/bin/magento install:wordpress

> -c /home/example/etc/php.ini /home/example/public_html/bin/magento install:woocommerce

> -c /home/example/etc/php.ini /home/example/public_html/bin/magento finally:dobusiness

 

 

 

 

 

 

 

 

Re: Should the Magento cron jobs update the index when set to "Update By Schedule"?

Is there anything being given away in your /var/spool/mail/<magentouser> file?

 

I recently found that "/var/www/shop.my-domain.co.uk/var/.update_cronjob_status" was failing to be written to during the cron job.