Run a script when load is too high

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/ it runs every minute from /etc/crontab yhe only requirement is BashCalc (bc)


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

In the damnnastyfix you could place something like:

killall -9 httpd
service httpd restart
Cloud & Open-Source magician 🧙‍♂️

I try to find the KISS in complex systems and share it with the world.

comments powered by Disqus