I have a mistake in a the cron function in a module, and it misbehaving. I started it manually, and it is going to be running for hours, looping through 340,000-odd nodes, so I'd like to stop it now. I don't have root on the server, the hosting company has not responded to request to reboot.

I tried renaming the tables to make it throw an sql error, but this hasn't stopped it from running, though it has stopped it from updating these tables.

Is there a way to stop it?

thanks, Julian

Comments

melaniemad’s picture

Hi Julian,

The page will probably timeout on its own, depending on your php.ini settings.

http://ca.php.net/manual/en/ref.info.php#ini.max-execution-time

Melanie

juliansomers’s picture

Max_execution_time is 30, but it has been running for several hours now. If only I could do an /etc/init.d/apache restart!

Crimson’s picture

How do you find out how long it has been running? Do you just run it again and then check the logs?

In my opinion, there should be a button or link in cron.php that allows the user to shut down cron.

aufumy’s picture

DELETE FROM `variable` WHERE name = 'cron_semaphore';
DELETE FROM `variable` WHERE name = 'cron_last';

Flush cache

TribalMan’s picture

Where do you place the above code? Or are these sql queries?

Is there a way to stop a stuck cron run with Drush?

scrambled’s picture

Just posting here incase someone was searching as I was:

drush vdel cron_semaphore
drush vdel cron_last

Great information regarding drupal cron: http://drupal.org/node/553430

koppie’s picture

People are still searching for the answer to this question. This helped. Thanks!

cyclone321’s picture

Thank You!

Hawkney’s picture

#############################################################
#Fix Cron Already Running Problem
#please replace ?text? appropriately

#log in to mysql from terminal:
mysql -u ?dbusername? -p

#Sequential mysql commands to fix:
------------------------------------
mysql> show databases;
mysql> use ?dbname?;
mysql> DELETE FROM `variable` WHERE name = 'cron_semaphore';
mysql> DELETE FROM `variable` WHERE name = 'cron_last';
mysql> exit
---------------------------------------------------

drush cc all

#Test
drush cron
############################################################