• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Kill all instances of the httpd daemon that are orphaned

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.......
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can use killall httpd
 
Pranav Butala
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I miss the old days when I would think up a sinister scheme for world domination and you would show a little emotional support. So just look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic