Hi there,

I put Drupal offline for site maintenance but it seems that the cron job can still be run by accessing cron.php.

When fiddling with the Drupal site and code of course I don't want the cron job to be executed.

So my question: Should the cron job page always be disabled when Drupal is off-line or should the site maintanance page have at least an option to do so?

Cheers
Mike

Comments

No one cares? Or is this the

No one cares? Or is this the wrong place to discuss?

maybe

maybe you can just rename the cron.php in your directory with a different name, so the cron job cannot be run from outside.

Bendo
--------------------------
My Blog: The Tommy's Project

Can I raise this question

Can I raise this question again?

I see it is an old post from

I see it is an old post from year ago, but there is no answer.
Maybe you can hack the cron.php to check

if(variable_get('site_offline', 0)) exit;

Haven't tried that, but I guess it will work in Drupal 6. I also think its a good idea to have a check box should drupal execute the cron, while in maintenance mode, like the person who posted this.

disabling the Drupal cron task

This is actually a very valid question... I found this thread because I have the same question, i.e. I would like to disable the cron task. Reasons that admins might want to disable the Drupal cron task include

  • removing Drupal from the system
  • database must be restored from a backup
  • having a large database that is used for other things besides Drupal and the backup takes a significant amount of time (and one doesn't want the Drupal cron task running or messing with the database during the backup)
  • the Drupal cron job gets hung
  • being a power user that wants to mess with the Drupal database schema, etc. while Drupal is online

As for the last point, I realize Drupal should be off-line if you are messing with the schema, but it is not absolutely necessary if you know what you are doing.

AzzzY's suggestion to modify the Drupal cron job is good in my opinion, but there should really be an administrative option for this purpose, and also there should be a note (along the lines of "Operating in off-line mode") if the cron job has been disabled. Messing with cron.php will not work for stylers. If anyone makes this change, it would also be good to have a cron status that displays the last time Drupal cron executed, and also if it is executing.

I am a coder and I would be happy to help with this issue.

Cheers!
Jim A.

Looking at the code in

Looking at the code in drupal_cron_run, you could set this following command when you want to disable cron

variable_set('cron_semaphore', time());

and this command when you want to resume

variable_del('cron_semaphore');

and that will give a 1 hour window for you to make the updates you need. You can also automate this in the command line by using some drush commands. I hope that helps!

James

James McBryan
Founder & Technical Lead
Twomile - http://www.thetechscouts.com
"Technical Guides for Social Good"

In Drupal 7 you can go to

In Drupal 7 you can go to admin/config/system/cron/settings
and disable cron tasks.