cancel
Showing results for 
Search instead for 
Did you mean: 

Cron Jobs

Cron Jobs

Hi,

 

I'd like to know which cron jobs do I need to setup in cpanel (siteground hosting) for magento to work?

 

right now I setup this: php bin/magento cron:run

 

is that enough? does it also include  "php bin/magento indexer:reindex" or do I need to setup other cron jobs?

5 REPLIES 5

Re: Cron Jobs

Hi @robertbits

 

To create a cron job for the Magento file system owner, enter the following command as a user with root privileges:

 

crontab -u <Magento file system owner username> -e

A text editor displays. (You might need to choose a text editor first.)

 
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log

 

where

  • <path to php binary> is the absolute file system path to your PHP binary
  • <magento install dir> is the directory in which you installed the Magento software; for example, /var/www
  • | grep -v "Ran jobs by schedule" filters this message from the log, making any errors easier to spot

This will also take care of indexing cron.

 

If you want to know steps with example you can follow these links:
https://inchoo.net/magento-2/running-cron-jobs-in-magento-2/

https://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html

 

If my answer is useful, please Accept as Solution & give Kudos.

Re: Cron Jobs

I think its better for you to not go in crontab yourself and set cron manually but let Magento do it for you. Ideally you can just your cpanel via ssh and run below command and that should do the needed cron setup for you.

php bin/magento cron:install


Re: Cron Jobs

@Sourabh Modi @Agarwal Aman

 

thanks for your response, but I cannot seem to be able to run the commands you gave me. I believe the problem is that I am hosting magento on shared hosting, and I don't have permissions to run those commands.

Re: Cron Jobs

Good evening everyone here! So, there are so many various opinions about this theme and I believe that this is okay. People have different requirements and different expectations. I usually carefully read all the conditions on the site https://uk.jooble.org/jobs-amazon/Nottingham because it helps to avoid common mistakes and shows you what you get at the end. I just think that it's quite difficult to find anything reliable right now, but I'm sure that everything will be great, and we will get what we want.