AOEpeople / Aoe_Scheduler

Cron Scheduler Module for Magento
http://fbrnc.net/blog/2011/03/magento-cron-schedule
GNU General Public License v3.0
373 stars 202 forks source link

Cron / Heartbeat not running with APC enabled #27

Open kayintveen opened 11 years ago

kayintveen commented 11 years ago

I've noticed that the heartbeat/cron in not running if APC is enabled. and to run the cron i need to disaple APC. is this a known issue?

andrey-legayev commented 11 years ago

Hi,

There might be no relation to Aoe_Scheduler Magento's cron may be run from command line (cron.sh) and not as cron.php via curl on your server On some Linux distributions php uses different php.d folders for mod_php and for command line By default APC is disabled and you may enable it for web version of php config

Just check all apc.ini files which you can find in /etc folder. You can find all these files using following command: find /etc -type f -name apc.ini

Another fix is to run Magento's cron via curl command (you need to edit /etc/crontab for that) But it has other nuances

Andrey.

kayintveen commented 11 years ago

Curl solved it for me!

SheriSmith commented 9 years ago

After installing APC as my OPCode Cache, my AOE Scheduler was showing that my cron was not working at all. After a few days of frustration, I fixed it by changing the command to: curl -s -o /dev/null http://www.mydomain.com/cron.php > /dev/null Ba-da-bing! Ba-da-boom!

fbrnc commented 9 years ago

Using cron.php to trigger cron is not a good idea. Using it via HTTP is even worse :)

Please configure your server to trigger cron.sh every minute (or every five minutes). cron.sh will internally take care of running cron.php with the correct modes.

I don't think this problem is related to APC at all since Magento's cron run with and without APC. One thing that's special about APC is that the web requests don't share the same cache with the cli processes. So in case you're not only using APC as an opcode cache, but also as a cache backend for Magento, this might have an effect on what's found in the cache and what's not. Again, even this situation shouldn't stop Magento from running. Magento store's the timestamp of the last run in the cache, but as long as your consistently running cron in the same context (again, this should always be cli and never web) you should be fine. And even if you ran it in different contexts it might end up generating the schedule more often, but it should still work.

I can't think of any other reason why APC should have an effect on cron.

vtrioafsar commented 9 years ago

Hello Fabrizio, I have already configured cron.sh to trigger every minute in the crontab settings. But the Scheduler Configuration page says

' Last heartbeat is older than one hour. Please check your settings and your configuration!' Do you think, is this some thing we can easily rectify ?

LeeSaferite commented 9 years ago

@vtrioafsar Just a question out of curiosity, what timezone is PHP set to as the default on your server?

php --info | grep timezone
razbakov commented 9 years ago

try to clean locks:

rm -rf /tmp/magento*

and check if there any cron processes running and kill them:

ps auxwww | grep cron.php