I have a little problem (which should be easy to solve), with a custom module I try to execute through crontab. For now, the only thing it is supposed to do is to print a log entry in dev.log file. Unfortunately, it doesn't, that's why I look for some help.
Below is how I've created my module.
app/etc/modules/Mycompany_Cronmodule.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Cronmodule>
<active>true</active>
<codePool>local</codePool>
</Mycompany_Cronmodule>
</modules>
</config>
app/code/local/Mycompany/Cronmodule/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Cronmodule>
<version>1.0</version>
</Mycompany_Cronmodule>
</modules>
<global>
<models>
<cronmodule>
<class>Mycompany_Cronmodule_Model</class>
</cronmodule>
</models>
</global>
<crontab>
<jobs>
<mycompany_cronmodule>
<schedule><cron_expr>* * * * *</cron_expr></schedule>
<run><model>cronmodule/observer::test</model></run>
</mycompany_cronmodule>
</jobs>
</crontab>
</config>
app/code/local/Mycompany/Cronmodule/Model/Observer.php
class Mycompany_Cronmodule_Model_Observer {
public function test(){
Mage::log("TEST success", null, "dev.log");
}
}
I have configured my windows task manager to execute cron.php every 5 minutes which works perfectly to send Magento emails (I run a local instance on a local windows with wamp).
Do you have any hints ?
Best Answer
It seems, that I have nothing wrong in my code, after cleaning the cache, I can see in the table magentocron_schedule a lot of Cronmodule tasks pending (and some executed). I also have my output in my log file which is perfect.
Thanks to this post to give me the hint to clean the cache: Can't get cron job to work