Thursday, March 11, 2010

An extremely simple load watchdog script.

#!/bin/bash
for myscript in run*.bash; do
    sleep 15
    myload=$(uptime | sed -e 's/,//g;s/\.//g'|awk '{print $(NF-2)}')
    while [ $myload -gt 320 ]; do
        sleep 5
        myload=$(uptime | sed -e 's/,//g;s/\.//g'|awk '{print $(NF-2)}')
    done
    bash $myscript &
done

No comments: