2

I added cronjob on the server but I still got this error 'One or more indexers are invalid. Make sure your Magento cron job is running.' on admin

I tried

cat /var/spool/cron/magento
*/1 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/users/magento/www/bin/magento cron:run
*/1 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/users/magento/www/update/cron.php
*/1 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/users/magento/www/bin/magento setup:cron:run

It seems it's working

cat /var/log/cron | grep php
Dec 27 09:59:01 CROND[31588]: (magento) CMD (/usr/local/bin/php -c /usr/local/lib/php.ini /home/users/magento/www/bin/magento cron:run)
Dec 27 09:59:01 CROND[31589]: (magento) CMD (/usr/local/bin/php -c /usr/local/lib/php.ini /home/users/magento/www/bin/magento setup:cron:run)
Dec 27 09:59:01 CROND[31590]: (magento) CMD (/usr/local/bin/php -c /usr/local/lib/php.ini /home/users/magento/www/update/cron.php )
Dec 27 10:00:01 CROND[31651]: (magento) CMD (/usr/local/bin/php -c /usr/local/lib/php.ini /home/users/magento/www/bin/magento cron:run)
Dec 27 10:00:01 CROND[31653]: (magento) CMD (/usr/local/bin/php -c /usr/local/lib/php.ini /home/users/magento/www/bin/magento setup:cron:run)
Dec 27 10:00:01 CROND[31663]: (magento) CMD (/usr/local/bin/php -c /usr/local/lib/php.ini /home/users/magento/www/update/cron.php )

I also tried

cat /var/spool/cron/magento
*/1 * * * * php -c /usr/local/lib/php.ini /home/users/magento/www/bin/magento cron:run
*/1 * * * * php -c /usr/local/lib/php.ini /home/users/magento/www/update/cron.php
*/1 * * * * php -c /usr/local/lib/php.ini /home/users/magento/www/bin/magento setup:cron:run

both seems working on server but Magento2 admin still show the error 'Make sure your Magento cron job is running.' How to solve and make it work? Thank you!

2

Just try to change the reindex mode from Update On Save to Update By Scheduled in my case works fine.

BTW: as far as i know in an standard situation you just need to point:

bin/magento cron:run

The others are: one for updates (in case you are contributing to magento2 github project) and other for connect/marketplace setup update. So in a production/test environment you just need the first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.