• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Kill all instances of the httpd daemon that are orphaned

 
Pranav Butala
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to write a bash script to kill all instances of the httpd daemon that are orphaned.
Normally I use /usr/local/apache2/bin/apachectl to stop and restart apache. It cleans up all of the http processes.
Yesterday I had to manually kill them doing kill -9 pid

used:
ps -ef | grep httpd
to see the process
[ February 19, 2004: Message edited by: Pranav Butala ]
 
himanshu patel
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we know which httpd instances are orphaned?
 
Pranav Butala
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ps -ef | grep httpd
displays all the processes that are oprhaned.
eg
root 11687 116876 0 18:38 00:00:00 /usr/local/apache2/bin/httpd -k
nobody 11689 116876 0 18:38 00:00:00 /usr/local/apache2/bin/httpd -k
nobody 11690 116876 0 18:38 00:00:00 /usr/local/apache2/bin/httpd -k
etc.......
 
heath carlough
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use killall httpd
 
Pranav Butala
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Figured out hoe to kill em:
#!/bin/bash
for pid in `ps -C httpd|sed -e 's/^\ \+//g' | grep httpd|awk '{print $1}'`
do
kill $pid
done
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic