Magento cron job and cron_scheduler table

I created a magento module that exports the product to a csv file. Now I want to run a cronjob every day at 23.55. I installed config.xml as it is written in the magento cronjob wiki .

My code is:

<crontab> <jobs> <gcompany_runprofilescronjob> <schedule> <cron_expr>55 23 * * *</cron_expr> </schedule> <run> <model>export/export_csv::runprofilescronjob</model> </run> </gcompany_runprofilescronjob> </jobs> </crontab> 

I also installed cronjob on the server. When running cronjob, all cronjob in magento is stored in the cron_schedule database table, but not in my gcompany_runprofilescronjob. If I set a different interval, for example:

 <cron_expr>*/1 * * * *</cron_expr> 

My cronjob is written in the database, but in execution every minute I donโ€™t want ... I want my function to be executed every day at 23.55. Any suggestions what am I doing wrong?

+6
source share
2 answers

Although this is a very old question, there is no right answer, so let me leave this here for the next guy.

Table

Magento cron_schedule populated only with cron jobs that are scheduled to run in the near future. The reason you don't see your cron job in the table is because it only works once a day, at exactly 23:55. Magento will add this cron job to the cron_schedule table cron_schedule approximately 11:45 cron_schedule , depending on the configuration of the cron server job and the settings of the Magento cron job in System > Configuration > System > Cron . Check out the Generate Schedules Every and Schedule Ahead for settings, which determine how often and how far ahead Magento generates a schedule.

+7
source

My first step would be to install the Fabrizio Branca extension of the AOE Scheduler . The Fabrizio extension has a List View feature that will show you all the Cron jobs currently registered in Magento cron and when they will be started. It also allows you to run a cron job right away in your browser (great for debugging cron jobs) or schedule work for immediate execution.

If your cron job does not appear in the AOE Scheduler list view, there is a problem with the cron job configuration. Try flushing the configuration cache to make sure Magento parses your config.xml for the latest changes. I assume that your XML node is in the appropriate place in the hierarchy of XML documents, i.e. directly below the <config> node?

If your cron job appears in the list view and is still not running, use the Create Schedule function to regenerate the cron scheduling tables. Also, try starting your cron job manually using the AOE Scheduler Run Now feature to check for errors or exceptions.

+4
source

All Articles