Book Image

Magento 2 Development Cookbook

Book Image

Magento 2 Development Cookbook

Overview of this book

With the challenges of growing an online business, Magento 2 is an open source e-commerce platform with innumerable functionalities that gives you the freedom to make on-the-fly decisions. It allows you to customize multiple levels of security permissions and enhance the look and feel of your website, and thus gives you a personalized experience in promoting your business.
Table of Contents (13 chapters)
12
Index

Introducing cronjobs


Cronjobs, or scheduled tasks, are background processes that keep your Magento webshop running by automating some tasks. Some examples of cronjobs are as follows:

  • Sending newsletters

  • Recalculating catalog promotion rules

  • Cleaning visitor logs

  • Sending price and stock alert e-mails

  • Updating currency rates

When the Magento cron is not configured correctly, you will see that some features of your Magento shop will not work as expected.

Getting ready

In this recipe, you will learn how you can configure cronjobs on the server and how you can verify that they are working. Open your SSH client and change to the Magento folder.

How to do it...

Using the following steps, we will configure cronjobs on the server:

  1. The Magento cron needs to be executed on periodic timestamps, for example, every five minutes. To run the crons, the following command is used:

    php bin/magento cron:run
    

    Tip

    To avoid permission problems, you have to run this command as the user that Apache uses to serve HTTP requests...