1

I have on setup on Magento and i have set cronjobs as per Magento guidelines as below.

* * * * * /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

When Magento projects get some more data like more Products, categories, orders. what is the best-practice to setup the cronjob schedule?

* * * * * This will run every minute on the server. after our Magento project is getting bigger what is the best practice to set the cron job time.

we can set the cron setting like * * * * * all the time as this will consume all your memory and CPU both

Looking for suggestions.

1

1 Answer 1

1
* * * * *

This is the actual way of cron scheduling in magento. You don't have to change it.

There are 3 levels of cron scheduling in magento.

  1. crontab - that you have used in question
  2. the second is from store->configuration->Advance->System->Cron, here you can change the timing when magento will check scheduling in codebase
  3. Last level is the scheduling in codebase. which you will find in crontab.xml in modules. This is the actual scheduling of cronjob.

The best way is to set magento cronjobs to * * * * * and from configuration use default values, and use your own scheduling in crotab.xml. So whenever you want to change scheduling you need to change in crontab.xml

Hope you find your answer :)

7
  • when our products, category will increase then what to do.. should we change the reindex cron schedule time? Nov 7, 2019 at 8:51
  • 1
    No, use flat data structure. Also you can use Update on Schedule option in indexing instead of Update on Save. I have 25k+ products and I am using same settings. And website is working perfectly Nov 7, 2019 at 8:55
  • ok, Thanks for replying. Nov 7, 2019 at 8:56
  • sorry, one more question. if I set indexing Update on Schedule then on what time the indexing will happen..? means where is the setting where I can see/change indexing schedule time? Nov 7, 2019 at 9:05
  • in crontab.xml of that module. Here is the actual scheduling Nov 7, 2019 at 9:23

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.