Creating Magento 2 Cron Job Cloudways

To create a Magento 2 cron job, you must log in as a user with root privileges (as mentioned earlier) and run the following command:

crontab -u -e

Now since the following commands are long and there is a chance of a mistake, I recommend using a text editor.

*/1 * * * * php -c <ini-file-path> <your Magento install dir>/bin/magento cron:run
*/1 * * * * php -c <ini-file-path> <your Magento install dir>/update/cron.php
*/1 * * * * php -c <ini-file-path> <your Magento install dir>/bin/magento setup:cron:run

The first command reindexes the indexers, sends automated emails and generates the sitemap. This command is associated with the PHP command line .ini file.

The other two commands are used for the Component Manager and System Upgrade.

Leave a comment

Your email address will not be published. Required fields are marked *