Command-line batch cron processing for Drupal

In which our hero carries on the time-honored tradition of posting some random snippet to his blog because he might wish to reference it later.

I occasionally need Drupal to execute its cron handler more than once. Today, I was trying to regenerate api documentation for about 18,000 files, which, understandably, is broken up into several cron runs. If I wait for the natural course of things, the documentation will take about three days to regenerate. If I run cron as fast as I can, it usually finishes in less than an hour. So here’s the snippet. Paste this bad boy in your favorite shell.

while true; do /usr/bin/wget -O - -q; done

When you’re done, hit ctrl+C to end the loop.

Note that each wget call blocks until it’s finished, so you don’t get a bunch of wget processes spawned. Basically it ensures that the next cron job is started as soon as possible after the previous one finishes.