Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

set up cron using config.xml
 
gskacha
Jr. Member
 
Total Posts:  21
Joined:  2011-01-06
 

Hi i am tring to set up cron in magento using config.xml. but anyreason its not working,
Here is the code which i am using.

config.xml

<?xml version=\\\"1.0\\\"?>
<config>
<global>
<models>
<mycompany_mymodule>
<class>Mycompany_Mymodule_Model</class>
</mycompany_mymodule>
</models>
</global>
<crontab>
<jobs>
<mycompany_mymodule>
<schedule><cron_expr>*/10 * * * *</cron_expr></schedule>
<run><model>mycompany_mymodule/observer::importproduct</model></run>
</mycompany_mymodule>
</jobs>
</crontab>
</config>

Observer.php

<?php
class Mycompany_Mymodule_Model_Observer {
public function Importproduct() {
Mage::log(\\\'cron works!!\\\',null,\\\'cron.log\\\');
}
} ?>

but its not working, can anybody help me.
Thank you in advance..

 
Magento Community Magento Community
Magento Community
Magento Community
 
aposadi
Jr. Member
 
Total Posts:  19
Joined:  2013-01-06
 

Are you sure that the problem is the cronjob and not the module...?

your file config.xml:

<?xml version=\"1.0\"?>
<config>
    <global>
        <
models>
            <
mycompany_mymodule>
                <class>
Mycompany_Mymodule_Model</class>
            </
mycompany_mymodule>
        </
models>
    </global>
    <
crontab>
        <
jobs>
            <
mycompany_mymodule>
                <
schedule><cron_expr>*/10 * * * *</cron_expr></schedule>
                <
run><model>mycompany_mymodule/observer::importproduct</model></run>
            </
mycompany_mymodule>
        </
jobs>
    </
crontab>
</
config>

maybe try that:

<?xml version=\"1.0\"?>
<config>
    <
modules>
        <
Mycompany_Mymodule>
            <
version>0.1.0</version>
        </
Mycompany_Mymodule>
    </
modules>
    <global>
        <
models>
            <
mymodule>
                <class>
Mycompany_Mymodule_Model</class>
            </
mymodule>
        </
models>
    </global>
    <
crontab>
        <
jobs>
            <
Mycompany_Mymodule>
                <
schedule><cron_expr>* * * * *</cron_expr></schedule>
                <
run><model>mymodule/observer::importproduct</model></run>
            </
Mycompany_Mymodule>
        </
jobs>
    </
crontab>
</
config>

then change the cron_expr

and remember the /etc/modules file…

 
Magento Community Magento Community
Magento Community
Magento Community
 
aposadi
Jr. Member
 
Total Posts:  19
Joined:  2013-01-06
 

and you function must be importproduct, not Importproduct… the config is case-sensitive

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top