disk usage alert script

disk usage alert script

Hello,

I want to make a script to alert if a specific directory space less than 50%. Does this seem to work?

#!/bin/bash
DLOC="/dev/sda1"
DVAL=`/bin/df -kl | /bin/grep $DLOC | /bin/sed 's/^.* \([0-9]*\)%.*$/\1/'`
if  [ $DVAL -gt 50 ]; then
 echo "Data:"
 echo -e "diskusage($DLOC):\t$DVAL"
fi





                New to ADSelfService Plus?