#!/bin/bash mt=your@domain.com ip=$(ifconfig|grep "inet addr" | awk '{print $2}'| awk -F: '{print $2}'| head -1) cm=$(free -m | grep buffers/cache | awk '{print $4}') jm=20 cl=$(uptime | awk -F average: '{print $2}'| awk '{print $1}' | awk -F, '{print $1}') jl=10 if [ $cm -ge $jm ] then echo Memory is enough else echo Memory is not enough free -m | mail -s "$ip -> Memory is not enough" $mt fi if [ `expr $cl \>= $jl` -eq 1 ] then echo Load is high uptime | mail -s "$ip -> Load is high" $mt else echo Load is not high fi