问题描述
我已配置cron工作在我的管理员的自定义模块在magento,但cron工作不工作。在我的 magento-> var-> log->系统日志文件 .below是我的完整模块details:。
I have configured cron job in my admin's custom module in magento but cron job is not working.Nothing in my magento->var->log->system log file.below is my full module details:.
JR-> CreateAdminController-> etc-> config.xml
JR->CreateAdminController->etc->config.xml
<?xml version="1.0"?>
<config>
<modules>
<JR_CreateAdminController>
<version>1.0.0</version>
</JR_CreateAdminController>
</modules>
<global>
<helpers>
<jr_createadmincontroller>
<!-- Helper definition needed by Magento -->
<class>Mage_Core_Helper</class>
</jr_createadmincontroller>
</helpers>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<jr_createadmincontroller before="Mage_Adminhtml">JR_CreateAdminController_Adminhtml</jr_createadmincontroller>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<petra>
<file>createadmincontroller.xml</file>
</petra>
</updates>
</layout>
</adminhtml>
<!-- ++++++++++++CRON JOB CODE++++++++++++ -->
<crontab>
<jobs>
<jr_createadmincontroller>
<schedule><cron_expr>* * * * *</cron_expr></schedule>
<run><model>createadmincontroller/observer::setStatus</model></run>
</jr_createadmincontroller>
</jobs>
</crontab>
</config>
JR-> CreateAdminController-> Model-> Observer.php
JR->CreateAdminController->Model->Observer.php
<?php
class JR_CreateAdminController_Model_Observer {
public function setStatus() {
echo "let see!!!";
Mage::log("WORKS!");
}
}
?>
为什么Mage :: log不会在我的日志文件中写任何东西,是否正在运行。 pLease帮助我!!!!
Why Mage::log not write any thing in my log file and also how will i check my cron is running or not. pLease help me out !!!!
推荐答案
你不在你的config.xml中声明你的模型, 。
您应该添加
You don't declare your models in your config.xml but observer is a model.You should add
<models>
<jr_createadmincontroller>
<class>JR_CreateAdminController_Model</class>
</jr_createadmincontroller>
</models>
在全局节点中。
并更改此
In the global node.And change this
<run><model>createadmincontroller/observer::setStatus</model></run>
按此:
<run><model>jr_createadmincontroller/observer::setStatus</model></run>
这篇关于Magento cron工作不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!