Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a cron job that executes a rake task in rails. I noticed in the log that it was running the task 4 times everytime it was executed. The problem is that there are 4 instances of cron running.

I ran:

/etc/init.d/crond stop

And now there are only three.

Running:

ps -ef | grep cron

I see this:

root      1029     1  0 Oct20 ?        00:00:01 crond
root      6980  6094  0 21:33 pts/0    00:00:00 grep cron
root     15170     1  0 Oct26 ?        00:00:00 crond start
root     15186     1  0 Oct26 ?        00:00:00 crond stop

So my question is how do I stop the other instances. When I run the stop command now I get this:

Stopping crond: cannot stop crond: crond is not running. [FAILED]

Any ideas? Do the other instances have different names? Is there a way to kill all instances as once?

share|improve this question

migrated from stackoverflow.com Oct 28 '10 at 23:35

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

    
This is probably a question better suited for unix.stackexchange.com, it may get closed as off-topic here. –  bta Oct 28 '10 at 21:45
add comment

2 Answers

Looks like you are going to have to kill them manually

killall crond

or

kill -9 pid1 pid2 ...

Then restart with init.d

share|improve this answer
    
Oh... thank you! That worked. –  Tim Stephenson Oct 28 '10 at 21:38
1  
With killall, it's worth noting that on some Unix systems (Solaris comes to mind), killall kills all processes. This usually causes your computer to stop entirely. –  Greg Hewgill Oct 28 '10 at 21:42
    
He used a linux tag, so it's probably not Solaris. On linux this send-sigterm-to-all-pids tool was renamed to killall5. –  Reef Oct 28 '10 at 23:28
    
Only use -9 as a last resort. Use the default which is SIGTERM (15). This gives processes a chance to do cleanup and exit gracefully. –  Dennis Williamson Oct 29 '10 at 2:26
add comment
sudo killall crond
share|improve this answer
1  
With killall, it's worth noting that on some Unix systems (Solaris comes to mind), killall kills all processes. This usually causes your computer to stop entirely. –  Greg Hewgill Oct 28 '10 at 21:41
2  
...that'd still fix it ;) –  dotalchemy Oct 28 '10 at 22:05
add comment

Your Answer

 
discard

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