Magento – Cron job not running

cronmagento-1.9

so as a still-newbie I came across the task to write a cron job for our ERP, which is supposed to run at 23:45 every day and put stock data from a .csv into the shop.

I am currently trying to test it with it being done every 10 minutes (which also seems to be the set standard, more about the "seems" later) so that I can see what happens.

However, it doesn't seem to do its job. I'm also trying to parse some string into a .log but as nothing changes there, I can assume it's not working.

I've run the function manually and it worked, so no problem there (atleast it shouldn't be).

My guess is I have a problem with the names in my config.xml, but I can't figure it out.

I'm also using another self-written module which saves the orders, used for the ERP so they are in the same module. I will include them here.

paths

app/
    code/
        local/
            COMPANY/
                Erp/
                    Model/
                        Observer.php
                    etc/
                        config.xml

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Company_Erp>
            <version>0.5.1</version>
        </Company_Erp>
    </modules>
<global>
    <models>
        <erp>
            <class>COMPANY_Erp_Model</class>
        </erp>
    </models>

    <events>
        <sales_order_place_after>
            <observers>
                <company_erp_model_observer>
                    <type>singleton</type>
                    <class>COMPANY_Erp_Model_Observer</class>
                    <method>writeOrderInfos</method>
                </company_erp_model_observer>
            </observers>
        </sales_order_place_after>
    </events>
</global>
<crontab>
    <jobs>
        <company_erp>
            <schedule>
                <cron_expr>*/10 * * * *</cron_expr>
            </schedule>
            <run>
                <model>erp/observer::updateStock</model>
            </run>
        </company_erp>
    </jobs>
</crontab>

file in app/etc/modules (COMPANY_Erp.xml)

<?xml version="1.0"?>
<config>
    <modules>
        <COMPANY_Erp>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Checkout />
            </depends>
        </COMPANY_Erp>
    </modules>
</config>

Observer.php

<?php

class COMPANY_Erp_Model_Observer {
    ...
    public function updateStock(){
        ...
        Mage::log('Cron job done!', null, 'company_erp.log', true);
    }
}

I know this is a long-a** post but I seriously don't know any further.

As I said, I don't know much about Magento, or CMS and stuff in general. I can work with them but understanding is a problem. I have no idea how to look whether cron.php is running on the server or not, but a co-worker said it is running. She tested it with "PuTTY" and said it runs every 10 minutes and writes the returns into nothing (null?), so I have a problem on my side.

I would appreciate any help or comments, as I do want to learn more. I like the structures in Magento but struggle very often.

Best Answer

Pleas check that you have configure cron.sh file in your cpanel cronjob and if it is there then you can install and check whether your cronjob running or not

https://www.magentocommerce.com/magento-connect/aoe-scheduler.html

Hope this will solve your conce

Related Topic