Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a PHP script on server that sends newsletter emails to my site users using a cron job. The users list is approximately 55,000 and takes nine hours.

Is there any way to stop it (urgently)?

share|improve this question

migrated from stackoverflow.com May 16 '11 at 5:31

This question came from our site for professional and enthusiast programmers.

    
bg; to get the processes runing, kill to it –  Ibu May 16 '11 at 4:49
    
Please describe how do i kill this? –  Sohail May 16 '11 at 4:52
3  
ps -e will give you the list of process, and kill processid (processid is a number) –  Ibu May 16 '11 at 4:54

4 Answers 4

up vote 4 down vote accepted

http://unix.derkeiler.com/Newsgroups/comp.unix.admin/2006-09/msg00132.html

http://unix.ittoolbox.com/groups/technical-functional/shellscript-l/how-to-kill-the-cronjob-which-is-running-currently-477250

You need to get the PID of your running cron job and then perform simple kill command.

share|improve this answer
    
Cron job script file is on host server. I have cPanel only. how do i check all processes by ps -e command? –  Sohail May 16 '11 at 5:06
1  
If you don't have any kind of SSH access to command terminal, you can't do that. –  Tomasz Kowalczyk May 16 '11 at 5:07
    
You may use the system command to exec something from your php script and see the output. –  Carlos Campderrós May 16 '11 at 11:04

someone already wrote u the answer,

try:

  1. ps -e | grep "php name file"

    the above command will display you the process id, so:

  2. kill - 9 'process ID'

    : )

share|improve this answer

I wouldn't suggest allowing the use of system(), exec(), passthru(), etc. Its a security issue.

If you do have a control panel, there has to be a way to manage the cron jobs, and I believe with most of them you also have the ability to launch an SSH session. You could use this method to stop/start the running process.

Last but not least, if you can't stop it yourself, contact your host.

share|improve this answer

Just comment out the specific cron job you want to not run. Switch to the user that controls the task, export your editor of choice into the environment, then use crontab -l:

$ su - root
...
# EDITOR=vi; export EDITOR
# crontab -l

If you are using cPanel. GO to Advance section of the Corn Job and click the Delete button.

If the delete button is not there, switch cPanel skin to 'X' to view the Delete button.

share|improve this answer
1  
Either you didn't read the question or you failed to understand it. The OP is asking how to stop an already running cron job, not how to edit it. –  John Gardeniers May 25 '11 at 4:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.