Skip to content

Instantly share code, notes, and snippets.

@igorhrq
Created June 26, 2020 18:18
Show Gist options
  • Save igorhrq/408456c581c595c4eb9e99c6880d4451 to your computer and use it in GitHub Desktop.
Save igorhrq/408456c581c595c4eb9e99c6880d4451 to your computer and use it in GitHub Desktop.
#!/bin/bash
load=`echo $(cat /proc/loadavg | awk '{print $1}') \> 8 | bc -l`
Release() {
release=$(egrep "5|6" /etc/redhat-release | awk {'print $4'} | cut -d. -f1)
if [[ -z $release ]]; then
mailPath=/usr/bin/mail
else
mailPath=/bin/mail
fi
}
if [ "$load" -ne 0 ]; then
Release
$mailPath -s "Load está alto $(hostname) Acima de $load " hey@igorlnx.com <<-MENSAGEM
** Esta é uma mensagem automática **
===================
O load vigente é:
$(w|head -1)
===================
MENSAGEM
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment