Showing results for 
Search instead for 
Did you mean: 

Magento 2 Cron Job Issue

Magento 2 Cron Job Issue

I just installed Magento 2 in our server and trying to setup Cron Jobs.


If I run $php bin/magento cron:run, I got Ran jobs by schedule and records are added under cron_schedule table, it seems its working..


And our PHP version is

$php -v
ea-php-cli Copyright 2017 cPanel, Inc.
PHP 7.0.26 (cli) (built: Dec 4 2017 16:10:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies


I added the following in our Cpanel 

 /usr/bin/php -q /home/xxx/public_html/bin/magento setup:cron:run >> /home/xxx/public_html/var/log/setup.cron.log
* * * * * /usr/bin/php -q /home/xxx/public_html/update/cron.php >> /home/xxx/public_html/var/log/update.cron.log
* * * * * /usr/bin/php -q /home/xxx/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/xxx/public_html/var/log/magento.cron.log


But it seems the automatic Cron jobs wasn't records are under cron_schedule table,


I see the following in 

bin/magento must be run as a CLI application magento.cron.log


Is the above log was an issue, how can I make sure my cron jobs are working..


Kindly let me to fix this..


Re: Magento 2 Cron Job Issue

Hi @zerosoft23,


Maybe I'm wrong but I don't recognize the -q param on your php execution.

Can you try removing that param?

You should get something like:


* * * * * /usr/bin/php /var/www/html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/html/update/cron.php >> /var/www/html/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/html/bin/magento setup:cron:run >> /var/www/html/var/log/setup.cron.log

(You will need to change the /var/www/html by your own path to Magento)

If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"