Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

magento cron job and cron_scheduler table

I made magento module which export product in csv file. Now i want to run cronjob every day at 23.55. I set config.xml as it is written in magento cronjob wiki.

My code:

<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 set cronjob on server. When cronjob run, all cronjobs in magento are stored in database table cron_schedule but not my gcompany_runprofilescronjob. If i set different interval for example:

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

My cronjob is written in database but in execute every minute which i don't want... I want that my function is executed every day at 23.55. Any suggestions what i am doing wrong?

like image 493
Gasper Avatar asked Apr 12 '13 13:04

Gasper


1 Answers

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

Magento's cron_schedule table is only populated with cron jobs that are scheduled to run in the near future. The reason you're not seeing your cron job in the table is because it only runs once a day, precisely at 23:55. Magento will add this cron job to the cron_schedule table at around 23:45, depending on your server cron job configuration and Magento's cron job settings in System > Configuration > System > Cron. Take note of the Generate Schedules Every and Schedule Ahead for settings, which define how often and how far ahead Magento generates the schedule.

like image 173
user4455361 Avatar answered Oct 03 '22 18:10

user4455361