11

In a normal production webiste, there are many tasks that need to be done via crontab, but lets say you dont want all of these tasks to run on every cron.

For example, i would love to have:

  1. A cron that run once a day, for the 'normal' maintenance (updates checks, for example)
  2. B cron that runs every 15 minutes, to send newsletters (from simplenews)
  3. C cron that run twice a day, that pull data from a view (json view) and write down a json file on the server (for a geomapping service with lots of data that doenst need a real-time sincronyzation).

Actually, i have a unique cron that do the A, B and C tasks on every run, every 15 minutes; so i created 2 php scripts that bootstrap drupal, one send the emails, and the other one cache the geomapping file.. it works, but is pretty a manual way that i dont like too much.

What is the best practice to set different crons, get all the modules hook_cron, and assign them only to a specific cron?

13

There is a module for that (tm):

http://drupal.org/project/elysia_cron

Have a look at http://2bits.com/drupal-performance/improving-performance-drupals-cron-using-elysia-cron-module.html for more information about it.

  • Thanks man, exactly what i was looking for! Strange things i googled around many times without results -.- – Strae Mar 4 '11 at 7:10

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.