cancel
Showing results for 
Search instead for 
Did you mean: 

Can't run cron

Can't run cron

I installed new cron tab, but I am still getting "One or more indexers are invalid. Make sure your Magento cron job is running"

 

so I tried to run the cron from command line to reindex and this is what I get:
$ php bin/magento cron:run --group index
PHP Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/lib/php/20170718/intl (/usr/lib/php/20170718/intl: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/intl.so (/usr/lib/php/20170718/intl.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Fatal error: Class 'IntlDateFormatter' not found in /var/www/vhosts/aksuits.com/httpdocs/magento/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 116

I know the new cron tab was built as I can list it

3 REPLIES 3

Re: Can't run cron

Hello @catalyst00 ,

 

There is look like issue on configure cron job, Please follow below steps to configure

 

There is look like cron is not configured on server as well so we got this type issue, Please configure as below and let me know.

 

To setup cronjob on server, Please follow below steps

Please log in on the server by the terminal

 

Find the PHP binary and php.ini path
To display the path to your PHP binary, enter

 

$ which php

A sample result follows:

 

 

/usr/bin/php

 

Create the cron job
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

For example,

 

 

$ crontab -u magento_user -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

The first command (magento cron:run) reindexes indexers, sends automated e-mails, generates the sitemap, and so on. Usually, it’s associated with the PHP command line .ini file. The other two commands are used by the Component Manager and System Upgrade

 

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

Re: Can't run cron

OK, I did what you asked, however, the last part which is editing the file to provide the absolute php path from step one. But where do I save the file? 
When I  try to exit the editor it asks to save the file and then it is asking where should the file be written, so what path should i give it save the file? 

Re: Can't run cron

Hello @catalyst00 ,

 

$ crontab -u magento_user -e

After run above command you will get editor then add below command as per requested changes

* * * * * <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

After please click Esc then :wq word that process to save it 

 

You don't want to save specific space.

 

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