This is a small script that can check if server load is too high and start another script.

It is NOT best practice to fix a problem like this but it can get you trough the nights while developers work on the code problem. I called my script /usr/local/bin/damnnastycheck.sh it runs every minute from /etc/crontab yhe only requirement is BashCalc (bc)

#!/bin/bash
high=8.1

if [ $(echo $(cat /proc/loadavg | awk '{print $1}')'>'$high | bc -l) == "1"  ]; then
  echo "high load, running fix"
  /usr/local/bin/damnnastyfix.sh
fi

In the damnnastyfix you could place something like:

#!/bin/bash
killall -9 httpd
service httpd restart

- Stein van Broekhoven


Comments

comments powered by Disqus