1

I have created a simple module with a config file and one observer to run a cron every minute. But the cron is not registering in the database as well as not executing at all. I tried running cron.php manually still no results. Here is my module's files:

config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
    <Inic_Icron>
        <version>1.0</version>
    </Inic_Icron>
</modules>
<global>        
    <models>
        <cron>
            <class>Inic_Icron_Model</class>
        </cron>
    </models>
</global>
<crontab>
    <jobs>
        <inic_icron_import_data>
            <schedule>
                <cron_expr>* * * * * *</cron_expr>
            </schedule>
            <run>
                <model>icron/observer::importdata</model>
            </run>
        </inic_icron_import_data>
    </jobs>
</crontab>

Observer.php

class Inic_Icron_Model_Observer
{
    public function importdata() {
        Mage::log("WORKS!");
    }
}

I can't figure out what I am doing wrong. I have cleared cache and tried running it manually still not result. Can anyone please help me?

2
  • Make sure that your system.log file as full permission otherwise you can print something inside importdata function.check error log as well Commented Aug 6, 2013 at 6:09
  • Yes the log file as full permissions and there are no error logs getting generated.
    – jdhaar
    Commented Aug 6, 2013 at 6:24

1 Answer 1

2

Maybe it's because you defined the model alias as cron

<cron><!-- model alias here-->
    <class>Inic_Icron_Model</class>
</cron>

and in your cron you call the model with alias icron:

<model>icron/observer::importdata</model>

Also make sure the module is loaded. I mean check if the file app/etc/modules/Inic_Icron.xml exists. You might want to clear the cache also.

1
  • That was the issue. Now the cron is getting registered in the table.
    – jdhaar
    Commented Aug 6, 2013 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.