Why Set Up Cronjob for setup:cron:run and update/cron.php in Magento 2 Production

crondeploymentmagento-2.0magento-2.1magento2

In Magento 2 there are three commands that should be set up as cronjob

* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log

The first command (magento cron:run) reindexes indexers, send automated e-mails, generates the sitemap, and so on. Usually it’s associated with the PHP command line .ini file. The other two commands are used by the Component Manager and System Upgrade.

Source: http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html

If I understand the docs correctly, update/cron.php and bin/magento setup:cron:run are only used for module installations and updates from the admin panel.

This is something that does not happen in a properly deployed production system where all updates are at least done on a staging system first, then moved to production.

So is there any reason to set up these cronjobs? What changes if I leave them out?

Best Answer

Updater and Setup cron jobs are used during upgrade via Web Setup Wizard only. Particularly, to enable message exchange between Setup component and Updater application. So if you are not planning to use Web Setup Wizard, it should be safe to disable these cron jobs. The worst thing that might happen, you will get readiness check failure on the attempt of using Web Setup Wizard.

Updater is an application independent from the Magento itself. It is used during Magento upgrade via Web Setup Wizard only and is distributed as part of Magento project package (not as Magento module and is not included into Magento product metapackage). It lives in a separate private git repository.

Since the updater cannot upgrade itself, it is the only component in Magento, which can only be upgraded manually via CLI. It means that you will not get newer updater version automatically during upgrade of Magento.

Related Topic