Work Magento cron

I configured my server (CPanel) to run cron.sh in the magento root folder every 5 minutes. But it does not work, and the cron_schedule table in the database is empty. Here is my config.xml

<config> <modules> <Company_Facebookreview> <version>1.0.0</version> </Company_Facebookreview> </modules> <global> <models> <facebookreview> <class>Company_Facebookreview_Model</class> <resourceModel>facebookreview_mysql4</resourceModel> </facebookreview> <facebookreview_mysql4> <class>Company_Facebookreview_Model_Mysql4</class> <entities> <facebookreview> <table>facebookreview</table> </facebookreview> </entities> </facebookreview_mysql4> </models> <resources> <facebookreview_setup> <setup> <module>Company_Facebookreview</module> <class>Mage_Sales_Model_Resource_Setup</class> </setup> </facebookreview_setup> </resources> <helpers> ... </helpers> <blocks> ... </blocks> <events> <sales_order_place_after> <observers> <place_order_after> <type>singleton</type> <class>Company_Facebookreview_Model_Observer</class> <method>save</method> </place_order_after> </observers> </sales_order_place_after> </events> </global> <crontab> <jobs> <facebookreview> <schedule> <cron_expr>*/5 * * * *</cron_expr> </schedule> <run> <model>facebookreview/observer::methodName</model> </run> </facebookreview> </jobs> </crontab> 

and here is my company /Facebookreview/Model/Observer.php

 class Company_Facebookreview_Model_Observer extends Varien_Event_Observer { public function save(Varien_Event_Observer $observer) { } public function methodName($schedule) { Mage::log('cron working fine');//cache is disabled and var folder has 777 permissions and var folder hasnt log folder } } 

the cache is disabled, and the var folder has 777 permissions, and the var folder does not have a log folder. I am using Magento Comunity 1.9. What am I doing wrong? please, help...

0
source share
2 answers

If the table cron_schedule is empty, then most likely either the system cron is not working or magento cron is not added to it.

Please cross this. You can add Magento Cron to the system cron as follows:

 */5 * * * * /bin/sh /path/to/magento/cron.sh 

OR you can add using the PHP method.

Also, to confirm that magento cron is working fine and the problem is related to one of the above cases, try opening the following URL in a browser:

 www.MAGENTOSITE.COM/cron.php 

If running this URL creates an entry in cron_schedule, you need to check the above things.

0
source

I have two suggestions.

Update cron.php

If you are using Magento 1.8, this will explain what you need to do: http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/magento1/cron-jobs-do-not-run-on -magento-1-8-after-upgrade

Make sure you are using the correct php version

Perhaps you are using an old version of php! By default, 1 and 1 in my case, just using the php command gets v4.4.9. I have to explicitly force php v5 and then it works!

I also recommend installing Fabrizio Branca AOE Scheduler Extension

0
source

Source: https://habr.com/ru/post/985520/


All Articles