Skip to content

Instantly share code, notes, and snippets.

@mttjohnson
Created April 4, 2016 20:23
Show Gist options
  • Save mttjohnson/5f838b4f5815819eb68f57b875b3b05e to your computer and use it in GitHub Desktop.
Save mttjohnson/5f838b4f5815819eb68f57b875b3b05e to your computer and use it in GitHub Desktop.
Magento 1.x Cron Debugging
Notes from conversations with David Alger and Zach Nanninga about Magento 1.x cron jobs runnign duplicate processes
running double cron jobs because of this section in cron.php:
if ($isShellDisabled) {
Mage::dispatchEvent('always');
Mage::dispatchEvent('default');
} else {
Mage::dispatchEvent($cronMode);
}
If you don't have shell_exec enabled and you have the crontab configured as outlined in your blog article, the cron will run default x 2 and always x 2 every time.
http://davidalger.com/development/magento/a-new-breed-of-cron-in-magento-ee-1-13-2/
Alternatively, another solution is you just use something like the following in the crontab:
php -d disable_functions= <path_to_cron>
That's defining the disable_functions as an empty list, meaning it enables shell_exec. The -d flag does precisely what they're doing, but much better, and specific to what you're doing.
To test whether shell_exec is enabled, you can do this:
php -r "var_dump(is_callable('shell_exec') && false === stripos(ini_get('disable_functions'), 'shell_exec'));"
If that evaluates to "true" then you are good. Otherwise adding the -d flag like David mentioned should cause it to be true.
syntax error: "Could not open input file..."
* ! test -e /home/xxxxxx/xxxxxx.com/html/maintenance.flag && /home/xxxxxx/xxxxxx.com/html/cron.sh "php -d disable_functions= cron.php" -m=default
cd /home/xxxxxx/xxxxxx.com/html && ! test -e ./maintenance.flag && ./cron.sh "/usr/bin/php -d disable_functions= cron.php" -m=always
^ that should do it, without making the command crazy long.
?: Could not open input file: .//usr/bin/php
?: It's prepending /usr with ./
?: This is what it produces:
?: /opt/nexcess/php55u/root/usr/bin/php /usr/bin/php -d disable_functions= cron.php
cd /home/xxxxxx/xxxxxx.com/html && ! test -e ./maintenance.flag && ./cron.sh "-d disable_functions= cron.php" -m=always
maybe it's just best to get the shell_exec set to be allowed on the server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment