Skip to content

The Magento 2 Cron

As added by default in the Cron > Schedule STRATUS Admin panel, the Magento 2 cron consists of 3 separate tasks that should be set as in the example below. Replace webroot with the full path to your install. Below are the defaults assuming the webroot is public_html on Mojo STRATUS.

/usr/local/bin/php /srv/public_html/bin/magento cron:run >> /srv/public_html/var/log/cron.log
/usr/local/bin/php /srv/public_html/update/cron.php >> /srv/public_html/var/log/mcron.log
/usr/local/bin/php /srv/public_html/bin/magento setup:cron:run >> /srv/public_html/var/log/mcron.log

WARNING: DO not use stdout/stderr redirection "2>&1" as this is already applied with the nice command during execution time. Adding it may prevent the cron from running entirely.

EXAMPLE: If you have set this cron:

/usr/local/bin/php /srv/public_html/bin/magento cron:run >> /srv/public_html/var/log/cron.log

the cron that will actually run at execution time will be:

/bin/bash -c /usr/share/stratus/cron.sh "nice -n 19 /usr/local/bin/php /srv/public_html/bin/magento cron:run >> /srv/public_html/var/log/cron.log" 2>&1

See also MageMojo Cron