clumsy hacks, if that’s what it takes

I haven’t yet figured out what makes my system here get so sluggish under load: I realize it’s memory-starved, but I don’t yet know why. In the meantime, I am running this script out of cron.

I haven’t yet figured out what makes my system here get so sluggish under load: I realize it’s memory-starved, but I don’t yet know why. In the meantime, I am running this script out of cron.

#!/usr/local/bin/bash
export FREEMEM=`vmstat 1 2 | tail -1 | cut -d" " -f7`
if [ ${FREEMEM} -lt  10240 ];
then logger "free memory @ ${FREEMEM}; restarting apache"
/usr/local/sbin/apachectl stop
sleep 10
killall -1 httpd
/usr/local/sbin/apachectl start
fi

feh. This somehow doesn’t always work if you use “-f7.” Overnight, it seemed to want to use the 8th field. Whatever . . .

Leave a Reply

Your email address will not be published. Required fields are marked *