1

For magento 2.2.4 my cron.sh looks like this (crontab is not available in this environment):

#!/bin/bash

PHP_BIN=`which php7-71STABLE-CLI`;

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BIN="$DIR/bin/magento"
INI="$DIR/php.ini"

$PHP_BIN -d max_execution_time=180 -d memory_limit=756M -c $INI $BIN cron:run | grep -v "Ran jobs by schedule" >> $DIR/var/log/magento.cron.log
$PHP_BIN -d max_execution_time=180 -d memory_limit=756M -c $INI $DIR/update/cron.php >> $DIR/var/log/update.cron.log
$PHP_BIN -d max_execution_time=180 -d memory_limit=756M -c $INI $BIN setup:cron:run >> $DIR/var/log/setup.cron.log

It is run every minute and produces no errors.

In the table cron_schedule I see all kinds of scheduled entries including indexer_reindex_all_invalid.

While others are properly executed the reindex never gets executed. It is stuck with status pending.

The cron config in backend is using the default options.

Manual php bin/magento indexer:reindex works fine but this should be done automatically as it is in my dev environment.

I googled and searched everywhere and ran out of options. What could possibly be wrong here?

2
  • have you run php bin/magento cron:install in terminal ? Jul 12 '18 at 9:25
  • Like I said: crontab is not available. The crons get planned from a cpanel type web frontend. The above shell script works just fine.
    – omsta
    Jul 12 '18 at 9:27
3

I finally found the solution. The crons in the magento backend were configured to use a separate process which does not work on our provider's server. Once I disabled that option the indexers were flying again.

2
  • how did you change this option?
    – zekia
    Feb 19 '19 at 10:37
  • Stores -> Configuration -> Advanced -> System -> Cron. There each cron group has a setting called "Use Separate Process". I set those to "No".
    – omsta
    Feb 19 '19 at 14:03

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.