LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 07-07-2006, 12:31 PM   #1
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Rep: Reputation: 15
Removing defunct httpd processes


I have come up with this little one liner to remove defunct httpd processes (which seem to linger forever unless I kill their parent process):

ps aux | grep defunct | egrep -v "grep|root" | awk '{print "cat /proc/" $2 "/stat"}' | sh | awk '{print $4}' | xargs kill > /dev/null 2>&1

The issue is, seemingly at random it will take down httpd full stop. I thought I could perhaps mitigate that and added the:

egrep -v "grep|root"

line to exclude the main root process of Apache from ever being included in the processes to be killed yet it has happened once again. I must stress the function does work, it works many many times then every so often kills Apache totally!

This is the message you'd expect from the Apache error logs:

[notice] caught SIGTERM, shutting down

when it happens.

Can anyone spot the probably obvious mistake I've made?

Thanks,

cg
 
Old 07-08-2006, 10:28 AM   #2
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Original Poster
Rep: Reputation: 15
No one?

cg
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
defunct processes in cron bujecas Debian 1 02-07-2006 02:59 PM
defunct processes appearing...and won't die! Axion Linux - Software 1 03-31-2004 12:43 PM
Crond running to many processes <defunct> tpfraz Linux - General 1 01-13-2004 08:03 AM
processes showing defunct jpbarto Linux - Software 2 11-05-2003 11:15 AM
httpd processes Hamma Linux - Software 16 06-02-2003 12:15 AM


All times are GMT -5. The time now is 04:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration