Magento Cron工作 [英] Magento cron job

查看:70
本文介绍了Magento Cron工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将服务器(CPanel)配置为每5分钟在magento根文件夹中运行cron.sh.但是它不起作用,数据库中的cron_schedule表为空.这是我的config.xml

I have configured my server (CPanel) to run cron.sh in magento root folder every 5 min. But it doesnt works and cron_schedule table in 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>

这是我的Company/Facebookreview/Model/Observer.php

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
}
}

缓存已禁用,并且var文件夹具有777权限,而var文件夹没有日志文件夹. 我正在使用Magento Comunity 1.9.我做错了什么?请帮忙...

cache is disabled and var folder has 777 permissions and var folder hasnt log folder. I am using Magento Comunity 1.9. What i am doing wrong ? please help...

推荐答案

我有两个建议.

更新cron.php

如果您使用的是Magento 1.8,那么这将说明您需要执行的操作: http://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/magento1/cron-jobs升级后无法在magento-1-8上运行

If you're using Magento 1.8, then 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

确保您使用的是正确版本的php

可能只是您使用的是旧版本的php!默认情况下,在我的情况下,在1and1上,仅使用php命令即可获取v4.4.9.我必须明确强制使用php v5,然后它才能工作!

It might simply be you're using an old version of php! By default, on 1and1 in my case, just using the php command gets v4.4.9. I have to explicitly force php v5 and then it works!

我还建议安装Fabrizio Branca的 AOE Scheduler扩展

I'd also recommend installing Fabrizio Branca's AOE Scheduler extension

这篇关于Magento Cron工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆