cancel
Showing results for 
Search instead for 
Did you mean: 

Confusion about Cron Jobs and Indexing

SOLVED

Confusion about Cron Jobs and Indexing

I'm working with Magento 2.1.13. I am trying to setup reindexing for stock/price every 5 minutes. 

 

In System > Index Management, I have the Stock and Price set to "Update by Schedule". 

In Stores > Configuration > Advanced > System, I have the Cron (Scheduled Tasks) > (Cron Configuration options for group : index) > Generate Schedules Every 5 minutes.

 

Do I need to setup a cron job separately? Or will this take care of reindexing?

 

I was confused by the different documentation for 2.1 vs 2.2. 


Can anyone clarify it for me?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Confusion about Cron Jobs and Indexing

@kitestopYes you need to schedule the cron job which can be done using the hosting control panel or command line. Setting you did is for when to generate the schedule for the cron to execute. Look at the below URL to get the details on how to configure the Magento cron. It also provide information like what all task can be taken care by cron.

 

https://devdocs.magento.com/guides/v2.1/config-guide/cli/config-cli-subcommands-cron.html

 

Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

View solution in original post

3 REPLIES 3

Re: Confusion about Cron Jobs and Indexing

@kitestopYes you need to schedule the cron job which can be done using the hosting control panel or command line. Setting you did is for when to generate the schedule for the cron to execute. Look at the below URL to get the details on how to configure the Magento cron. It also provide information like what all task can be taken care by cron.

 

https://devdocs.magento.com/guides/v2.1/config-guide/cli/config-cli-subcommands-cron.html

 

Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: Confusion about Cron Jobs and Indexing

If I add the following cron jobs (with correct path), is that all? Or do I need to create a file to run bin/magento indexer:reindex ??

 

* * * * * /usr/bin/php /var/www/magento2/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/magento2/update/cron.php >> /var/www/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/magento2/bin/magento setup:cron:run >> /var/www/magento2/var/log/setup.cron.log

 

Re: Confusion about Cron Jobs and Indexing

@kitestop 

 

If PHP path is correct then that should be it. With PHP 7 you may have to use usr/bin/php71 or usr/bin/php72 instead of php.

 

Run those command from the command prompt. If run successfully then go ahead and configure them.

 

Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.