My site's logs show that cron is triggered if someone visits the website. This is slowing down the load time for the first visit.

The cron is configured to run each 3 hours here: Administration » Configuration » System » Cron.

How can I run the cron scheduled and not triggered by visitors?

2 Answers 2


You should start by reading the Drupal handbook pages about cron to get background and commands to run.

  • If you have shell/SSH access to the (Linux) server, you can run use run crontab -u www-data -e to edit the cron table for the web user. You should be able to use the details in the above link to set up proper cron runs as often as you'd like.
  • If you're on shared hosting without shell access, you'll need to use your web host's control panel (CPanel, Plesk etc.) to log in and add a 'Scheduled Task'. This provides as web interface to the cron tabs, so the same settings will be needed.
  • If these are not available you'll need to ask your hosting company to help, but there are also free and paid services you can use call the cron.php page remotely for you. See Set Cron Job for example.

Take a look like the Elysia Cron module if you want more out of cron in general -- it's got good documentation and allows you to finely control what tasks run when.

Finally, remember to disable the site running it when visitors arrive at Administration » Configuration » System » Cron when you've managed to set this up.

  • I have shell access. I know how to set up cron jobs. So I will figure it out. But thanks for summarizing all the information.
    – cateye
    Dec 27, 2011 at 13:57
  • But what I don't understand is, why Drupal behaves like it does now. If the basic configuration is scheduled to run the cron each 3 hours, why does it wait for a visitor?
    – cateye
    Dec 27, 2011 at 13:58
  • 1
    Thinking about it. There is off course for Drupal no way to run a cron job without bootstrapping. And the bootstrapping occurs when a visitor hits the site. So, the summary is: If you want really scheduled cron jobs, you have to set it up server side.
    – cateye
    Dec 27, 2011 at 14:04
  • 2
    Exactly. Nothing happens on a server without someone or something running it. The Drupal 7 default is to run cron when users arrive occasionally to ensure key tasks get run. Drupal 6 relied on the Poor Man's Cron module to do this in the absence of a proper cron job... and almost everything in Drupal needs the bootstrap to happen first. A proper cron job on the server is certainly the best option. Dec 27, 2011 at 14:48
  • 1
    The ANSWER BELOW describes how to fix it. Not this one :( Dec 17, 2014 at 10:48

Drupal 7 incorporated in its modules the code that were in Poormanscron, whose purpose is exactly to run Drupal cron tasks on a site where it is not possible to set cron tasks, when a user visits your site, and every X hours (as set in the page you saw).

If you want to avoid that behavior, you just need to set "Run cron every" to "Never"; contrary to what it could seem, that just influences what happens when users visit your site.[1] You can still run Drupal cron tasks from outside Drupal, remembering that in Drupal 7 cron.php needs to be invoked, from outside Drupal, passing the value shown in "Administration > Reports > Status report."








[1]: In fact, neither cron.php, nor drupal_cron_run() checks the Drupal variable used in that settings page. The only Drupal variables used are:

  • "cron_key" that contains the cron key used to avoid the Drupal cron tasks are ran from unauthorized users
  • "maintenance_mode" that is set to TRUE when the site is in maintenance mode
  • "cron_last" that contains the timestamp of when cron tasks were ran last time
  • The only difficulty is when the cron job times out every time you view the page and you can't even login as admin to disable it! sigh... I'll figure it out but good to know it can be disabled, once I actually get in there
    – user11312
    Mar 17, 2013 at 4:16
  • Yeah, I solved this quickly by setting up a Montastic uptime monitor that "checks" the cron activation URL every 6 hours...
    – Anders
    May 16, 2013 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.