2

I have created cron jobs @ every 1 min to run. And I run the http://localhost/magento/cron.php. but it's not working.

My Code is:

Observer.php

<?php
class Easylife_CJobs_Model_Observer {
    public function setStatus() {
        Mage::log("Cron Jobs Working Fine!",null,"cronjobs");
    }
}

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_CJobs>
            <version>0.1.0</version>
        </Easylife_CJobs>
    </modules>
    <global>
        <models>
            <cjobs>
                <class>Easylife_CJobs_Model</class>
            </cjobs>
        </models>
    </global>
    <crontab>
        <jobs>
            <cjobs>
                <schedule>
                    <cron_expr>*/1 * * * *</cron_expr>
                </schedule>
                <run>
                    <model>Easylife_CJobs_Model_Observer::setStatus</model>
                </run>
            </cjobs>
        </jobs>
    </crontab>
</config>

Please let me know is this procedure is correct else is another procedure?

4

Model node should contain the model reference <model>cjobs/observer::setStatus</model> instead of a full class name.

Also make sure logging is turned on or put true as fourth argument to Mage::log() in order to force writing the "Cron Jobs Working Fine!" log.

|improve this answer|||||
  • Warning: include(): Failed opening 'Easylife\CJobs\Model\Easylife\CJobs\Model\Observer.php' Error is Came. – M_N Apr 10 '15 at 12:22
  • I have modified config.xml file. now working fine. Thank You. – M_N Apr 10 '15 at 12:24
2

My advice is also look at cron_schedule table if you debug cron. If you did it you could understand that the problem is following:

exception 'Mage_Core_Exception' with message 'Invalid model/method definition, expecting "model/class::method".' in /var/www/local.dev/www/mg18com/app/Mage.php:595

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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