Boost your customer loyalty effortlessly Learn more

Shopping cart

How to Configure Cronjob Magento 2 - Schedule Tasks

magento-2-tutorial
how-to
configure
cronjob
schedule
task
featured

Configure Cronjob in Magento 2 (Schedule Tasks) allows some operations run automatically on your Magento 2 site via a script you have written in the configuration. The operations you can control their scheduling from Magento Scheduler include:

The cron job is the awesome periodical method to make any of your important programs active automatically and properly instead of doing them manually. However, it is sure that the base URLs for the store are set correctly, so the URLs that are generated and used during cron operations are correct as well as the cron can be run perfectly.

Thus, this tutorial will help know what you need to do to configure the cron.

Configure cron (Scheduled Task) in Magento 2

  • On the Admin panel, click Stores. In the Settings section, select Configuration.
  • Select System under Advanced in the panel on the left
  • Open the Cron section, and continue with following:

How to Configure Cronjob - Schedule Tasks

  • Open Cron configuration options for group: Index and Cron configuration options for group: Default section and complete all following information

How to Configure Cronjob - Schedule Tasks

How to Configure Cronjob - Schedule Tasks

  • Generate Schedules Every
  • Schedule Ahead for
  • Missed if not Run Within
  • History Cleanup Every
  • Success History Lifetime
  • Failure History Lifetime
  • Use Separate Process

  • When complete, click Save Config

Setup Magento 2 Cronjob command line

To setup cron job for Magento 2, you should run the following command line to update the cronjob table:

crontab -e 

Add the following lines to your crontab file:

*/1 * * * * php -c {php.ini_path} {magento_path}/bin/magento cron:run
*/1 * * * * php -c {php.ini_path} {magento_path}/update/cron.php
*/1 * * * * php -c {php.ini_path} {magento_path}/bin/magento setup:cron:run

In this case, our enviroment is that: {php.ini_path} is /etc/php5/apache2/php.ini ; and {magento_path} is /var/www/m2, so the command cronjob is:

*/1 * * * * php -c /etc/php5/apache2/php.ini /var/www/m2/bin/magento cron:run
*/1 * * * * php -c /etc/php5/apache2/php.ini /var/www/m2/update/cron.php
*/1 * * * * php -c /etc/php5/apache2/php.ini /var/www/m2/bin/magento setup:cron:run

Save and close the crontab file.

  • Nano editor: Press Ctrl + O to save then Ctrl + X to quit.
  • Vim editor: Press Escape, :wq to save and quit.

Ref: Magento 2 User Guide

It comes to the end of tutorial: How to Configure Cronjob Magento 2 - Schedule Tasks.

PDF Invoice samples for Magento 2

mageplaza pdf invoice

Want to apply these above Invoice templates for your store?

See how

Please leave comments if you have any questions, feedbacks.

Comments for How to Configure Cronjob Magento 2 - Schedule Tasks

You also may like these Magento 2 Extensions

One Step Checkout

$199
77 reviews

Layered Navigation

$99
44 reviews

SEO

FREE
29 reviews

Better Blog

FREE
58 reviews

Gift Card

$199
5 reviews

Reward Points

$149
4 reviews

Affiliate

$149
12 reviews

People also searched for:

  • Configure Cronjob Magento 2
  • Schedule Tasks in Magento 2
  • Configure Cronjob - Schedule Tasks in Magento 2
  • setup cron job magento 2
  • setup cron job magento 2 cpanel
  • setup cron job for magento 2
  • configure cron jobs in magento 2
  • how to setup cron job magento 2