Posted By

randompage on 01/01/11


Tagged

Bash child Apache2 startup grace


Versions (?)

kill gracefully stuck startup of apache childs..


 / Published in: Bash
 

URL: http://www.findpdf.us/

simple bash script to kill apache childs with status "Gracefully finishing" or "G" status. you may put it at cron

  1. #!/bin/bash
  2.  
  3. echo "kill gracefully stuck startup of apache childs.. "
  4.  
  5. apache2ctl fullstatus | awk '{print $2,$4}' | grep G | awk '{print $1}' | sort -u | grep "^[0-9]*$" | sort -n | while read -r pida
  6. do
  7. pidc=$(ps -p $pida -Ocommand | grep apache2 | wc -l)
  8. if [ $pidc -gt 0 ] ; then
  9. kill -9 $pida
  10. echo "killing $pida "
  11. fi
  12. done
  13.  
  14. echo " "
  15. echo " done."
  16. echo " "

Report this snippet  

You need to login to post a comment.