2

I have a site in development. It has Feeds module installed, with mandatoty Job Scheduler also installed. When I come back to the office to keep working on the site, it takes almost a minute for the webpage to complete. I have checked the log messages, and says that it is the Cron doing its tasks. The Feeds imports are switched off, and configured to launch only on submission (admin), and the cron is scheduled every 3 hours, in times different to those in which the problem appears, apparently it is the visit to the webpage what launches the Cron tasks.

How can I check what is causing the problem?

3 Answers 3

2

The cron can make different tasks such as check for updates to Drupal core and modules, removing temporary files, index content and cleaning up log files.

When you enter to your site the cron is executed and performs his tasks every X hours. You need enter to your site to activate the cron execution, if you want a different behavior you need read this: https://www.drupal.org/cron

There is no way for Drupal to run a cron job without bootstrapping. And the bootstrapping occurs when a visitor hits the site (Nothing happens on a server without someone or something running it). If you want really scheduled cron jobs, you have to set it up server side and this is certainly the best option, for this read: https://www.drupal.org/node/23714

Edit: I found now this article Why Drupal cron is not running as often as you think and how to fix it

4
  • I recieve a downvote, the downvoter can explain his point of view please? I can improve my answer. Thanks Nov 30, 2015 at 18:01
  • I used to do this behaviour when doing pure PHP sites, to execute cron tasks when the user hit the page, so no need of a Linux daemon or crontab. I had completely forgotten about this, I later realized. I have tried Job Scheduler trigger, but it does not set the date correctly. I use 15 15 * * * for doing the task at 15:15 but the date is set sometime in the following months. I will have to go to Linux command.
    – Cesar
    Nov 30, 2015 at 18:11
  • @Cesar I edit with an aditional article. I think that you must read it. Dec 3, 2015 at 15:00
  • @Cesar a pleasure help you ;-) Dec 3, 2015 at 17:55
2

For Drupal to work properly, it has to run certain background tasks from time to time. These are all categorised under the heading "cron" because that's the name of the *nix service that's used for scheduling background tasks.

As @Adrian Cid Almaguer says you should read https://www.drupal.org/cron for more about this. You can schedule cron from control panel in most hosting environments.

If you DON'T schedule cron automatically, there's a feature called "poormanscron" that gets run when someone visits your site. As you've noticed this means prolonged response times for the unlucky person. So the lesson is to set up cron to run automatically. You need to configure it so the automated cron runs more frequently than the time configured under Adminstration > Configuration > System > Cron Settings, otherwise poormanscron will still run sometimes.

1

with elysia cron module you have full control in your admin UI, but need to add some executions to your cron tab.

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.