Jun 28, 2010
I created a cron job with a loop on it that executes 10 times. I activated it and set it to run every minute. Afterwards, i realized i forgot to add a condition to the loop, so its stuck in an infinite loop and has been for 5 hours. I changed the php file but the ones that the server is already executing are stuck and i cant stop them. How do i stop cronjobs that are stuck running on the server? HELP! They are doing quite some damage! :(


Oct 26, 2009

As the cron job you have set is in infinite loop and thus it is getting exeicuted since last 5 hours.

So In my opinion stopping cron or removing the job now wont help you.

But by using following command you can search for the exact process in loop

# ps -faux | grep crond

This command will show all the crond running processes on server. Look for perticular process you want to kill take its PID and kill the process Manually as

# killall -9 PID

If you dont have shell access to execute these commands please contact your web hosting support, they might do this for you.
Last edited:


Active Member
Oct 29, 2008
and when doing the above, make sure you restart crond afterwards :)

But yeah, you should be able to use ps aux to find the rogue process and kill it by ID.


Jun 24, 2005
Addendum to what the others said, you can also rename, delete,
or change the permissions to non-executable the cron script so that
way cron can't respawn the process while you go kill the existing
processes still running in memory.

So basically in a nutshell ---

1. Remove your script from being run by cron

2. ps aux | grep (script name)

3. Kill the processes found running

4. Remove the cron line calling the script

5. Restart cron

6. Check again to make sure you got all the running processes

Now you should be able to rewrite the script correctly and set it up in cron again. :D

Now one thing that does have me a little concerned in what you said is that you are trying to "loop 10 times" yet running every minute. Out of curiosity, exactly what is it that you are trying to do exactly?