3

All cron jobs were scheduled but not executed.

Googled it lot but no help. I have checked this too.

Then found this link

As it described I have added this line $isShellDisabled = true; and cron start executing.

$disabledFuncs = explode(',', ini_get('disable_functions'));
$isShellDisabled = is_array($disabledFuncs) ? in_array('shell_exec', $disabledFuncs) : true;
$isShellDisabled = (stripos(PHP_OS, 'win') === false) ? $isShellDisabled : true;
$isShellDisabled = true; //newly added line

Question

Is it OK to add this line?

I am running site in "ventraip" hosting provider.

3

Modifying core files is not a recommended practice at all. Luckily there is another solution, but first let me explain what this line is doing:

The three lines before try to figure out if PHP is allowed to execute shell commands and set $isShellDisabled = true if not.

If it is false, cron.php will start two cron.sh processes in the background

cron.sh /path/to/cron.php -mdefault
cron.sh /path/to/cron.php -malways

cron.sh in turn, runs cron.php (with the same arguments) if it doesn't find a running cron.php process. At least in theory, apparently checking for a running process does not work if the process has been spawned from cron.php as described above.

Now, if $isShellDisabled is true, this is not possible and cron.php will run in both modes ("default" and "always") one after another.

Solution

You can leave out the first step of all this and set up your crontab directly with two jobs:

cron.sh cron.php -mdefault
cron.sh cron.php -malways

(with full path to cron.sh and cron.php) This way you'll have a working check if there is already a running process, but you cannot specify the path to the PHP binary to be used.

If that's important, use this instead:

/path/to/php cron.php -mdefault
/path/to/php cron.php -malways
  • 1
    Thank you @fschmengler. I will try your solution tomorrow. – Adarsh Khatri Sep 20 '16 at 7:07
1

The issue could be magento_root/cron.php not set in server crontab. We need to add this file in crontab so it worked for us as follow.

# crontab -l (this command will list all the Cron jobs in Crontab)

There should be an entry for magento_root/cron.php file. If not, we need to add this file because this file is responsible for initiating your Magento Cron jobs. So we need to edit the Crontab as follow.

# crontab -e

Add the following statement in the file and close after saving it.

*/5 * * * * wget -O /dev/null -q path_to_magento_root/cron.php > /dev/null

For more information, visit this link

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.