Setting up the Magento cronjob (Magento 2)

From XTENTO Support Wiki
Jump to: navigation, search

This is a guide for Magento 2. For Magento 1 extensions and guides, please refer to Magento 1 Guides.

Please refer to the official Magento 2 documentation on how to set up the Magento cronjob: http://devdocs.magento.com/guides/v2.2/config-guide/cli/config-cli-subcommands-cron.html

Contents

Troubleshooting

n98-magerun2: No job config found!

n98-magerun2 does not support cronjobs defined only via the database in core_config_data. These are perfectly fine cronjobs though. You just can't run them using n98-magerun2.

Stalled Cronjobs / No cronjobs scheduled

Please note you will ONLY see entries in the import/export execution log if it actually did something. If 0 orders are exported, or 0 stock level updates got processed, nothing is logged in the execution log.

Possible solutions for common cron issues:

* * * * * or */5 0 * * * or 0 0 * * *

An invalid cron expression could look like this for example: * * * * * * (Too many parameters - must be 5 exactly) or 00 02 * * * (5 parameters, but hour/minute must be specified using single digits, so 0 and 2 instead of 00 and 02)

Setting up cronjobs directly in crontab

For our import/export extensions, imports/exports can be directly started via the command line:

Example: php bin/magento xtento:productexport:export 123

Where 123 is the profile ID you want to run. This will execute the profile using the cronjob mode.

Simply set up an entry in crontab directly if you want to avoid the Magento cron scheduler and instead use crontab to schedule exports from there. When using crontab to run your exports, be sure to disable "Automatic Export" in the import/export profile as it could run twice otherwise.

Personal tools
Namespaces
Variants
Actions
General Information
Magento 2 Guides
Magento 2 Extensions
Magento 1 Guides
Magento 1 Extensions
Magento Integration Suite
Product Feed Guides
Toolbox