First of all I wish to express how a third-party extension to list the crobjobs is not what I am looking for, I shall omit my opinion for how Magento handles cronjobs.

My problem is when I query the database SELECT * FROM cron_schedule; my modules cron is not listed there, thus I can only assume my cron configuration is wrong, but so far I've not found any resources to help.

Cron set-up

My cron has been set-up on the server to run every 5 minutes (this is where I dislike Magento abstracting cronjobs).

crontab -e

*/5 * * * * /bin/sh /home/site/public_html/cron.sh > /dev/null &2>1

For the exercise of getting my cron to run, I am running the cron from the command line $ /bin/sh cron.sh - Inside the cron_schedule I see that executed_at is updated but not for my cronjob but an existing modules cron.





                    <cron_expr>0 0 * * *</cron_expr>


class Myvendor_Mymodule_Model_Cron
    //public static function someMethod() #= no luck either
    public function someMethod()
        Mage::log('test', null, 'hello.log');

2 Answers 2


The cron_schedule tables contains a list of scheduled cronjobs, including the time they've been added to the schedule, the scheduled exectution time, the state, and, when done, the time they've finished.

The table is populated when the cron.sh script is run (should run every 5 minutes via the system cronjob (crontab -e -u )). The first call will populate the table and later work off the queue. You can think of the cron_schedule table as a job-queue where the exection-times are based on your config.xml.

Magento will schedule the crons automatically, so you don't need to take care of it. Make sure you've refreshed the config-cache after adding the cronjob and the cron.sh runs periodically. Also usually it's better to run cron.sh instead of cron.php because in the new versions Magento uses different run modes and calls the cron.php with the appropriate configuration, umask, path, etc. automatically.

This extension might be interesting for you: https://github.com/AOEmedia/Aoe_Scheduler

  • @Marius - Personally I dislike the way Magento has abstracted crontab. Linux has implemented crontab in a simple and elegant manner, imo Magento has just complicated the process by using databases and forking background processes then routing stout/stderr to /dev/null. As a server administrator myself I dislike my control being taken from me.
    – Ash
    Feb 14, 2014 at 14:54
  • I take that back - problem hasn't been solved >.> my module cron still is not appearing the cron_schedule ARGH!
    – Ash
    Feb 14, 2014 at 14:58
  • Totally agreed. One of the "features" in Magento that could have been easier. Back to your Problem: If you install Aoe_Scheduler can you see the cronjob in the list? And is the module active anyway (app/etc/modules/Myvendor_Mymodule.xml)? Maybe the issue is not the cron at all?
    – thebod
    Feb 14, 2014 at 14:58
  • @thebod - OK, I will have ponder and see. It's strange that when I run the cron my task doesn't get added to the cron_schedule table, which is why I thought it was the config.xml syntax. My question is what does AOE_Scheduler do that SELECT * FROM cron_schedule doesn't?
    – Ash
    Feb 14, 2014 at 15:07
  • Aoe_Scheduler also reads the configuration to show a list of available cronjobs. You can enable/disable them there, see a timeline with execution times, etc...
    – thebod
    Feb 14, 2014 at 15:14

Make sure that your cron.php or cron.sh is set to run regularly in Linux cron file.

From magento cron manual

The cron.php file located in the Magento root will need to be run periodically, for example every 15 minutes. Basically, this script will check if it needs to run any tasks, and if it needs to schedule any future tasks.


The problem is that <cron_expr>0 0 * * *</cron_expr> means Daily at midnight. But magento is not putting tasks into cron_schedule immediately. Only if execution time is very close. Try to change cron_expr to <cron_expr>*/5 * * * *</cron_expr>. And you should see the difference.

  • I updated my question to include the crontab schedule for clarity. Regardless, I am running the cron.sh from the terminal directly, I can see executed_at being updated but no new cron in my list.
    – Ash
    Feb 14, 2014 at 13:56
  • Set cron_expr to * * * * *. And check if your job was executed. Feb 14, 2014 at 13:58
  • That's not going to change anything because I am running cron.sh on the command line. I know my crontab is set-up correctly, but I'm not sure about my config.xml syntax.
    – Ash
    Feb 14, 2014 at 14:01
  • your config.xml syntax is correct. Feb 14, 2014 at 14:04
  • Okay, that good. So here's the process - I run bin/sh cron.sh which forks cron.php -- options in the background. Magento then checks for crons it needs to run from cron_schedule. How do I register my cron task into the cron_schedule table using that config.xml?
    – Ash
    Feb 14, 2014 at 14:06

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.