I was created the Cron jobs it is showing on admin panel and I have set the time also, but it is not running.

my code is


<?xml version="1.0"?>

        <Auto translate="label">
            <label>Auto Replenish</label>
        <autoreplenish translate="label" module="autoreplenish">
            <label>Auto Replenish Settings</label>
                <general_settings translate="label">
                    <label>Enable Auto Replenish</label>
                        <enable_disable translate="label, comment">
                <configurable_cron translate="label">
                    <label>Cron Schedule</label>
                        <time translate="label">
                            <label>Start Time</label>
                        <frequency translate="label">



class Easylife_Autoreplenish_Model_Adminhtml_System_Config_Backend_Autoreplenish_Cron extends Mage_Core_Model_Config_Data
    const CRON_STRING_PATH = 'crontab/jobs/my_cron/schedule/cron_expr';
    protected function _afterSave()
        $time = $this->getData('groups/configurable_cron/fields/time/value');
        $frequencyDaily = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_DAILY;
        $frequencyWeekly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY;
        $frequencyMonthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY;
        $cronDayOfWeek = date('N');
        $cronExprArray = array(
            intval($time[1]),                                   # Minute
            intval($time[0]),                                   # Hour
            (frequency == $frequencyMonthly) ? '1' : '*',       # Day of the Month
            '*',                                                # Month of the Year
            (frequency == $frequencyWeekly) ? '1' : '*',        # Day of the Week
        $cronExprString = join(' ', $cronExprArray);
        try {
                ->load(self::CRON_STRING_PATH, 'path')
        catch (Exception $e) {
            throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'));



class Easylife_Autoreplenish_Model_Replenish
    public function run()
        Mage::log("Cron Jobs");
        return true;





I am save the CST time @ 11:38:00 and it's saved on core_config_data as catalog/configurable_cron/time = 11,38,00 & catalog/configurable_cron/frequency = D & crontab/jobs/my_cron/schedule/cron_expr = 38 11 * * *. But it's not saved on cron_schedule.

Can you tell me where I went wrong?

Thanks in advance.

  • 1
    I assume it is because there is no cron_expr in your config.xml and when cron.php is run there is no store so there is no core_config_data, maybe have a look at Mage_Cron_Model_Schedule::setCronExpr – David Manners May 22 '14 at 7:32
  • @DavidManners, Yes I don't have cron_expr in my config.xml Because I have stored in core_config_data. – Manoj Kumar May 22 '14 at 7:49
  • do you call the cron.sh via linux cron regularly? – Fabian Blechschmidt May 22 '14 at 8:26
  • @FabianBlechschmidt, No, I'm using windows. Can you tell me how can call cron.sh via windows. – Manoj Kumar May 22 '14 at 8:51
  • Manoj I have no idea. But without external call to the magento cron there will no cronjob run. What you can do is just call php cron.php – Fabian Blechschmidt May 22 '14 at 9:05

Please make sure you run Magento's cron.php (located in Magento root folder) every 5 minutes or so (in your server's crontab). Doing so, Magento will check all the XML files for your modules and check for the nodes. Then it will add jobs to the queue in table cron_schedule (in your DB). After a short moment, you shoudl see this table populating. Magento will launch the crons by itself.

Hope this helped.

|improve this answer|||||
  • how can i run `cron.php'? can u suggest me. – Manoj Kumar May 22 '14 at 8:52
  • 1
    in your server's /etc/crontab add the line suggested by @sebastian */5 * * * * php -f /path/to/magento/cron.php – Julien Lachal May 23 '14 at 12:16

As mentioned by Julien you have to run cron.php in root directory. With

crontab -e

in terminal you can add the cronjob to the server. This is the entry you have to make:

*/5 * * * * php -f /path/to/magento/cron.php

To list all cronjobs you can use

crontab -l

I read to late that your magento is running on windows. On windows you use the task scheduler to run cron.php

|improve this answer|||||

I strongly recommend AOE Scheduler extension to see what's going on with cron. Among other things it shows if Magento has "heartbeat". If not, then it probably means that there's something amiss with crontab: either it doesn't run cron.php, insufficent permissions, you try to run it directly without interpreter or your path is wrong.

You can find the extension here:


|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.