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
Solved! Go to Solution.
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!
Hello @nypedrogmad4a4
Can you please check update.log.
Please use the PHP CLI command while setting the cron job.
I hope it helps.
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
I used crontab -l and they are in my crontable
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.
@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.
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!