/ Published in: Bash

simple bash script to kill apache childs with status "Gracefully finishing" or "G" status. you may put it at cron
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/bash echo "kill gracefully stuck startup of apache childs.. " apache2ctl fullstatus | awk '{print $2,$4}' | grep G | awk '{print $1}' | sort -u | grep "^[0-9]*$" | sort -n | while read -r pida do pidc=$(ps -p $pida -Ocommand | grep apache2 | wc -l) if [ $pidc -gt 0 ] ; then kill -9 $pida echo "killing $pida " fi done echo " " echo " done." echo " "
Comments
