Return to Snippet

Revision: 38415
at January 1, 2011 14:14 by randompage


Initial Code
#!/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 " "

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

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

Initial Title
kill gracefully stuck startup of apache childs..

Initial Tags
Bash

Initial Language
Bash