Preparing for Search with Cron and Poormanscron

Like most websites, a Drupal website normally springs into action when it receives a request for a page. Like the web server and the database that support the site, it is idle for much of the time. (Even the busiest websites are idle for much of the time. To provide responsive service, the web server and network normally run well below 100% capacity to allow for temporary peaks of demand.)

Certain tasks, such as preparing indexes, need to be done in the background. Many systems have such tasks, ranging from periodic backups to checking for new versions of software, which Drupal does regularly. In many web environments, these tasks are managed by a job scheduler called cron (from chronograph). On Windows, there are versions of cron, but many people use the built-in scheduling of Windows.

As far as Drupal is concerned, a script that is installed as part of Drupal should be run periodically. It is accessible at in the standard Drupal installation. You can run it manually by going to that page in your browser, or you can schedule it to be run by cron or the Windows scheduler. As an alternative, you can use a contributed module, poormanscron.

When fired off by cron or the Windows scheduler, cron.php performs tasks such as indexing and checking for updates. Drupal manages this for you: All you have to do is start cron.php.

In some environments, cron is not available. Typically, these are shared hosting environments where several users share the same server. A few years ago, cron was not made available on shared servers. Today, as technology for sharing has improved, you are more likely to find cron available. If it is available, it is the best solution. Schedule it to run cron.php regularly. How regularly depends on your website and its demands. If it is a heavily trafficked site with a great deal of searchable content being added all the time, you may want cron.php to run once an hour so that it can keep the search indexes up to date. On the other hand, a heavily trafficked site that is not updated often may need cron.php to be run once a day or even once a week. Large sites may run it every few minutes.

The Poormanscron module is triggered whenever Drupal receives a page request. It checks to see if it would be appropriate to run cron.php, and, if so, it does so. It is not the time-dependent processing of a true cron job, but it works in many cases. In order not to degrade the user experience, the actual run of cron.php is started after the page has been sent to the user. Presumably, the user is looking at the page while the cron job is running.

If you are going to use Poormanscron, download, install, and enable it as described in Table 9.1.

TABLE 9.1 Poormanscron Module Reference

Download from project/poormanscron

Enable in section Other




Administer, Site Configuration, Poormanscron (admin/settings/poormanscron)

Was this article helpful?

0 0


  • ella
    How to manually trigger poormanscron?
    8 years ago

Post a comment