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:
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...