Skip to content

Instantly share code, notes, and snippets.

@erickvasilev
Last active March 13, 2018 10:55
Show Gist options
  • Save erickvasilev/cc9fdc2a78e3cb22429abec8fd350eb4 to your computer and use it in GitHub Desktop.
Save erickvasilev/cc9fdc2a78e3cb22429abec8fd350eb4 to your computer and use it in GitHub Desktop.
Check if high load
#!/bin/bash
trigger=2.30
load=`cat /proc/loadavg | awk '{print $1}'`
response=`echo | awk -v T=$trigger -v L=$load 'BEGIN{if ( L > T){ print "greater"}}'`
if [[ $response = "greater" ]]
then
reboot
else
echo $load
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment