#!/bin/bash
host=`hostname`
DIRLIST=(/home /root / )
for dir in "${DIRLIST[@]}"
do
  tst=`df $dir | tail --lines=+2 | sed s/%//g | awk '{ if($5 > 10) print $5;}'`
  if [ "$tst" != "" ] ; then
     msg=`df -h $dir | head --lines=+2 | sed s/%//g| awk '{ if($5 > 10) print $6,"     ",$5;}'`
    (echo "Below Directory on $host has crossed the threshold limit of 90%. Please Take necessary action."; echo ; echo "$msg"; )| mail -s "Disk Space Alert on : $host" -r "root@server1.cbinetwhm.bi" "anthony@cbinet.net"
#    (echo "Below Directory on $host has crossed the threshold limit of 90%. Please Take necessary action."; echo ; echo "$msg"; )| mail -s "Disk Space Alert on : $host anthony@cbinet.net
fi

done
