kill gracefully stuck startup of apache childs..


/ Published in: Bash
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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 " "

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.