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

I am trying to restart Apache on my server but it does not seem to kill all the processes that Apache is currently running.

The command I am using is

sudo /etc/init.d/apache2 restart

Is there something else I should be doing that will kill all the child processes too?

Thanks

Josh Pennington

share|improve this question
    
What kind of processes aren't killed that should be? CGI scripts? Other subprocesses? Also, what operating system are you running? –  Wolph Aug 10 '10 at 22:26
    
From his provided command (apache2) I'd guess it's Debian based, and the fact that he's using sudo automatically for root privileges (rather than the root shell) suggests Ubuntu to me, but I could be wrong. –  James Lawrie Aug 10 '10 at 22:38
    
Sorry for the lack of detail. I am running the command from the command line and the OS is Debian. –  Josh Pennington Aug 10 '10 at 22:43

2 Answers 2

up vote 1 down vote accepted

The child processes should stop as soon as they finish handling their current requests. Do you really want your server drop connections in the middle of serving a page? The restarted server will handle all new connections, as it has taken over listening for new connections.

Check after a minute or so to ensure that the children of the old server have died. If they are still running then you likely have a problem.

share|improve this answer
    
I checked this and the process IDs do in fact change. I had assumed that they were not changing because the new processes seemed to be taking up about the same amount of RAM as the old processes. Do you know if there is a logical reason why Apache would be taking about the same amount of RAM as processes that have been killed? –  Josh Pennington Aug 10 '10 at 23:19
    
@Josh If the service's workload hasn't changed dramatically since it was restarted, why wouldn't it require the same amount of RAM as before? –  Skyhawk Aug 11 '10 at 0:08
    
Each process is using a lot more memory than I would have expected for a fresh process to take up. I would expect that each process take up a lot less memory than it did when I killed the process. –  Josh Pennington Aug 11 '10 at 1:19
    
Unless you are loading something that builds and hangs onto memory structures as your run, the processes will use about the same amount of memory. Normally if the memory footprint is growing, it is a sign of a memory leak. The runner processes don't need to keep much in memory. Mostly they just read and send files with some possible filtering. This requires a few kilo bytes at most. –  BillThor Aug 11 '10 at 20:02

Something processes can get locked. Try:
sudo /etc/init.d/apache stop
sudo pgrep apache
If the above command returns anything, do:
sudo pkill -9 apache
Then start apache again:
sudo /etc/init.d/apache2 start

share|improve this answer

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.