cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Cron job not working in Magento 2.3.4

SOLVED

Problem with Cron job not working in Magento 2.3.4

Hi I am trying to get the cron job to work via cpanel for Magento 2.3.4 and it doesn't seem to be working. Here is the cron I am using. 

 

/usr/bin/php /home2/pmstore/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home2/pmstore/public_html/var/log/magento.cron.log

 

/usr/bin/php /home2/pmstore/public_html/update/cron.php >> /home2/pmstore/public_html/var/log/update.cron.log

 

/usr/bin/php /home2/pmstore/public_html/bin/magento setup:cron:run >> /home2/pmstore/public_html/var/log/setup.cron.log

 

I tried using SSH but that didn't work for me so I used the cron jobs options in cpanel. Does that look correct above? It's still not indexing.

 

Pete

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Problem with Cron job not working in Magento 2.3.4

OK We are on to something

 

I added LOCAL to make it work

 

/usr/local/bin/ea-php73 /home2/pmstore/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home2/pmstore/public_html/var/log/magento.cron.log

 

and it worked fine when entered in command line

 

I found an memory error and fixed that in the php.ini and it all works. Thanks for your help all!

 

View solution in original post

7 REPLIES 7

Re: Problem with Cron job not working in Magento 2.3.4

Hello @nypedrogmad4a4 

 

Can you please check update.log.

Please use the PHP CLI command while setting the cron job.

 

I hope it helps.

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Problem with Cron job not working in Magento 2.3.4

Hello @nypedrogmad4a4 

 

Running the cron job results in a row being added to the cron_schedule table with the name of the cron job. Please validate this table as it contains cron or not. If its not there then please check your custom cron

Manish Mittal
https://www.manishmittal.com/

Re: Problem with Cron job not working in Magento 2.3.4

I used crontab -l and they are in my crontable

Re: Problem with Cron job not working in Magento 2.3.4

I don't understand how to use PHP CLI command.

 


@Sanjay Jethva wrote:

Hello @nypedrogmad4a4 

 

Can you please check update.log.

Please use the PHP CLI command while setting the cron job.

 

I hope it helps.


 

Re: Problem with Cron job not working in Magento 2.3.4

@nypedrogmad4a4  Hi Pete,

 

There are multiple ways to check if your cron jobs are working or now.

 

1. Run the commant directly on command line while you are connected to server via ssh. Just For example: /usr/bin/php /home2/pmstore/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home2/pmstore/public_html/var/log/magento.cron.log

 

use the above command and see if it gives you an error or it runs without error.

 

2. You can view magento.cron.log file at "/home2/pmstore/public_html/var/log/" folder.

 

3. In database you have a table cron_schedule. Every time if cron runs it insert bunch of entries in this table.

 

Note: /usr/bin/php also many of times require to have php version. For example /usr/bin/php72 or /usr/bin/php73

 

You can check with hosting provider what is the correct format you have to use, just in case you could not figure out.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: Problem with Cron job not working in Magento 2.3.4

OK We are on to something

 

I added LOCAL to make it work

 

/usr/local/bin/ea-php73 /home2/pmstore/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home2/pmstore/public_html/var/log/magento.cron.log

 

and it worked fine when entered in command line

 

I found an memory error and fixed that in the php.ini and it all works. Thanks for your help all!

 

Re: Problem with Cron job not working in Magento 2.3.4

Welcome to The Kroger Company, the home of your future. We are one of the largest grocers in the country as well as one of the best places for people to work. We believe that our employees are our most valuable asset and we make sure to take care of them. From my life at Kroger training programs to new recruits, we want everyone who walks through our door to feel confident that we Will open doors for you and provide a great career opportunity.