3

I'd like to run cron every 5 minutes, but the UI doesn't offer any increment of time smaller than an hour. I'm assuming the solution is as simple as

  • creating a feature module for the setting, and changing the integer to 300 (60 seconds × 5), OR
  • cracking open the database and changing the value to 300.

Are there any hidden 'gotchas' with either of those approaches (or any reason they'll fail)? Is there a better way?

10

You can get really fine-grained control over your cron runs with these modules:

  • Elyisa cron

    Elysia Cron extends Drupal standard cron, allowing a fine grain control over each task and several ways to add custom cron jobs to your site.

  • Ultimate Cron

    The Ultimate Cron handling for Drupal. Runs cron jobs individually in parallel using configurable rules, pool management and load balancing.

(In no particular order) I've only used Elysia cron before, and only recently at that, but it works well.

Either module will let you use a standard cron rule to define it's frequency, which I think means you can get the granularity down as far as seconds if you need it.

I think the only gotcha is that the more often you run cron (if it has expensive tasks to perform), the more load there will be on your server. Testing and benchmarking are the only real way to solve that one :)

5

You can also just run a cron job from the server. If Cpanel is in use, it's simple to run cron.php on any schedule.

  • 1
    Heh, oh yeah...Drupal has consumed me, I can't conceive of a non-module based solution to anything any more :P – Clive Oct 4 '12 at 18:04
  • Is there any advantage to this? I'd be happy to use a real crontab (not from Cpanel but from the Unix command line) if there's some hidden problem with Drupal's built-in "cron", or some advantage (reliability?) of using a real crontab. However, it's much nicer to keep things together, and not have an external dependency that must be managed separately from everything else, so a real crontab definitely has a strong disadvantage in that respect. – iconoclast Oct 4 '12 at 18:42
  • 2
    AFAIK, Drupal's built-in cron runs on page load which makes for a slower user experience. – keva Oct 5 '12 at 21:03

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.