Questions? We're happy to help

How do I manually set up the Magento cronjob?

There are a lot of little tasks to do when you have a magento shop; reindexing, updating product information etc. These tasks can be executed by using the Magento cron.

In this article we’ll explain how to setup the Magento 1 and Magento 2 cron

Set up the Magento 1 cron

How does the cronjob look?

The cronjobs looks like this:

*/5 * * * * php /home/domein1q/public_html/cron.php

You’ll have to change domein1q into your own username and make sure the path is the precise location of the cron.php file.

Setup the cronjob through Cpanel

If you want to setup the cronjob through cPanel add it like in the below image:

Set up the Magento 1 cron

It’s important to adjust the php part in the command if you don’t have the following line of code in your crontab:

PATH=/usr/local/bin/:/usr/bin:/bin

If you don’t have that in your crontab, please consider the next options:

*/5 * * * * /opt/cpanel/ea-php70/root/usr/bin/php /home/domein1q/public_html/cron.php (if you want to use PHP 7)

*/5 * * * * /opt/cpanel/ea-php56/root/usr/bin/php /home/domein1q/public_html/cron.php (if you want to use PHP 5.6)

Set up the Magento 2 cron

How does the cronjob look?

The cronjobs looks like this:

* * * * * php /home/domein1q/public_html/update/cron.php >> /home/domein1q/public_html/var/log/update.cron.log

* * * * * php /home/domein1q/public_html/bin/magento setup:cron:run >> /home/domein1q/public_html/var/log/setup.cron.log

* * * * * php /home/domein1q/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/domein1q/public_html/var/log/magento.cron.log

You’ll have to change domein1q into your own username and make sure the path is the precise location of the cron.php file.

Setup the cronjob through cPanel

If you want to setup the cronjob through cPanel add it like in the below image:

Set up Magento 2 cron

It’s important to adjust the php part in the command if you don’t have the following line of code in your crontab:

PATH=/usr/local/bin/:/usr/bin:/bin

If you don’t have that in your crontab, please consider the next options:

* * * * * /opt/cpanel/ea-php70/root/usr/bin/php /home/domein1q/public_html/update/cron.php >> /home/domein1q/public_html/var/log/update.cron.log

* * * * * /opt/cpanel/ea-php70/root/usr/bin/php /home/domein1q/public_html/bin/magento setup:cron:run >> /home/domein1q/public_html/var/log/setup.cron.log

* * * * * /opt/cpanel/ea-php70/root/usr/bin/php /home/domein1q/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/domein1q/public_html/var/log/magento.cron.log

 

This knowledgebase article was last updated on: 23 October 2017

Did this article help you?

Status

Ga naar onze statuspagina voor een overzicht van recente storingen en onderhoud.

Opening hours

Maandag — vrijdag 9:00 — 17:00