0

This may or may not have anything to do with my question HERE. While investigating the issue, I checked the system.log file and found these two entries listed over and over:

2015-05-27T16:00:47+00:00 ERR (3): Warning: shell_exec() [function.shell-exec]: Unable to execute '/bin/sh /home/lbingman/public_html/cron.sh cron.php -mdefault 1 > /dev/null 2>&1 &' in /home/lbingman/public_html/cron.php on line 64

2015-05-27T16:00:47+00:00 ERR (3): Warning: shell_exec() [function.shell-exec]: Unable to execute '/bin/sh /home/lbingman/public_html/cron.sh cron.php -malways 1 > /dev/null 2>&1 &' in /home/lbingman/public_html/cron.php on line 65

So, of course I take a look at cron.php and find this...

Line 64: shell_exec("/bin/sh $baseDir/cron.sh $fileName -mdefault 1 > /dev/null 2>&1 &");

Line 65: shell_exec("/bin/sh $baseDir/cron.sh $fileName -malways 1 > /dev/null 2>&1 &");

Is there some bad code that I am not aware of? Or is there something else going on that is causing these errors that isn't code related? I am having issues with cron not being executed. Then when I manually execute cron.php via my web browser, it runs and runs without stopping.

3
  • I should note that these errors are a result of having a cron job setup for cron.sh. I have it set this way because of the issue I am having with the other question asked in the link I mentioned.
    – Lucas
    May 28, 2015 at 15:08
  • I got the correct command line for the cron job set per my hosting provider. Now I'm going to make sure cron is actually "firing" like it's set to do. If it is, then my problem is probably within Magento somewhere.
    – Lucas
    May 28, 2015 at 18:15
  • According to my hosting provider, cron.sh and cron.php are both able to be executed and are functioning properly. So, I guess the issue is with Magento somewhere.
    – Lucas
    May 28, 2015 at 21:11

1 Answer 1

1

First of all, check PHP safe_mode is Off & shell_exec() is not included in disable_functions in php.ini, then...

Be sure that cron.php file has permissions to be executable

Be sure too, that the cron command is properly written, for instance

15/* * * * * /usr/bin/php -q <path_to_magento>/cron.php
6
  • What would the proper code be for running cron.sh? I believe these errors are happening because I am attempting to run cron.sh as a cron job instead of cron.php.
    – Lucas
    May 28, 2015 at 15:09
  • Try this 15/* * * * * /bin/sh <path_to_magento>/cron.sh Again, be sure that cron.sh has permissions to be executable May 28, 2015 at 15:31
  • I got the correct command line for the cron job set per my hosting provider. For me, it's "/usr/bin/ssh --silent shademountainarmory.com/cron.sh 2 > /dev/null". Now I'm going to make sure cron is actually "firing" like it's set to do. If it is, then my problem is probably within Magento somewhere. Is that a correct assumption?
    – Lucas
    May 28, 2015 at 18:16
  • According to my hosting provider, cron.sh and cron.php are both able to be executed and are functioning properly. So, I guess the issue is with Magento somewhere.
    – Lucas
    May 28, 2015 at 21:11
  • I wrote a generic command, /bin/sh should work in a Unix system (such a VPS, for instance). In shared hostings, you'd contact hosting support, as the command you've posted seems totally concrete of your hosting (or maybe you have made a typo error, and /usr/bin/ssh means /usr/bin/sh?) May 29, 2015 at 9:30

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.