Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

Drupal: Quick Cron Diagnostic

Submitted by on January 23, 2012 – 8:25 amNo Comment

In this article I would tell you how  to find our the reasons of why cron hangs up and fix them. Read the solution options below.

Indexing

Reduce the number of documents for indexing at a single cron start on search settings page. It’s better to run cron once a day.

Email distribution

If you have installed simple news, it may be a reason of cron hanging up. Sending a lot of emails doesn’t have a positive effect on cron.

Not enough time

try to change cron.php file in the following way:

// If not in ‘safe mode’, increase the maximum execution time:
// if (!ini_get(‘safe_mode’)) {
set_time_limit(1800);
// }

I.e. comment these lines.

Who is in fault?

Please do the following to figure out which module is in fault that cron hangs up: in includes/module.inc, in the last function (function module_invoke_all()), replace 404-405 line:

foreach (module_implements($hook) as $module) {
$function = $module .’_’. $hook;

with this one:

foreach (module_implements($hook) as $module) {
if ($hook == ‘cron’) {
watchdog(‘cron_runs’, $module); }
$function = $module .’_’. $hook;

Thus you will have a new category “cron_runs” in a log. The category will contain a list of modules which called cron. The last module is a “guilty” one.

Please do not forget to get all files back after you make diagnostics.

Message: “Trying to restart…” when a procedure is performing.

The reason of why you see this message is that wget can call cron.php up to 20 times at  a stretch if it doesn’t get the acceptable response. Read more info here: http://drupal.org/node/150972

You can also close access to a cron “from outside” in this way:
Add the following code to .htaccess file:

<Files “cron.php”>
Order deny,allow
Allow from xxx.xxx.xxx.xxx
Deny from all
</Files>

Replace xxx.xxx.xxx.xxx with IP you want to enable cron launch from.

Good luck!

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.