0

I have a local module with a cron job configured in config.xml to run once per day at 10:30am:

<sc_followup>
    <schedule>
        <cron_expr>30 10 * * *</cron_expr>
    </schedule>
    <run>                          
        <model>followup/cron::processFollowupEmails</model>
    </run>
</sc_followup>

I also have the system's crontab set up to run cron.php every 5 minutes:

*/5 * * * * php -f /abspath/mysite/cron.php > abspath/mysite/var/log/cron.log

The admin cron settings are: enter image description here

Lastly, I have cleared the caches.

My issue is that processFollowupEmails() is running once every 5 minutes instead of once per day at 10:30am. What do I need to change in my configuration to achieve that?

  • show please your cron_schedule table – zhartaunik May 4 '15 at 17:06
  • I think my problem is that I misunderstood the use of cron.php. It seems that it is intended to execute every task without regard to the config.xml settings. – Reflexorozy May 4 '15 at 17:07
  • I posted the output of crontab -l for my web user above. I do not have access to the entire server's schedule. – Reflexorozy May 4 '15 at 17:20
  • No, cron work depends on table cron_schedule. Show SELECT * FROM cron_schedule – zhartaunik May 4 '15 at 17:24
  • Is processFollowupEmails either a public or a static public method? – musicliftsme May 4 '15 at 17:26
1

It turned out that the above configuration does work for me. My mistake was in not accounting for the time between when the last cron schedule was generated and when the new schedule is generated.

When I was testing processFollowupEmails(), I had the config.xml settings at */5 * * * *. I updated it, but it kept running every 5 minutes until the "generate schedules"/"schedule ahead" settings came around again.

I'm leaving this answer here intead of deleting the question in case any one else forgets about the scheduling ahead.

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.