#!/bin/bash freememory=$(free -m | grep "cache:" | awk '{print $4}') threshold="300" if [ $freememory -gt $threshold ]; then echo "There is $freememory MB availible. Threshold not reached." else echo "There is less than $threshold MB of memory availible." /home/david/mail.sh "There is less than $threshold MB of memory availible!! You should probably do something about that pretty soon brother!!" fi exit 0