5tarl0rd

Current Path : /scripts/
Upload File :
Current File : //scripts/diskcheck.sh

#!/bin/sh
df -H | grep -vE '^Filesystem|tmpfs|cdrom|boot' | awk '{ print $5 " " $1 " " $6 }' | while read output;
do
  echo $output
  usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
  partition=$(echo $output | awk '{ print $2 }' )
  if [ $usep -ge 95 ]; then
    echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
     mail -s "Alert: Almost out of disk space $usep%" hosting@comsats.net.pk
  fi
done


5tarL0rd By 5tarl0rd Being Anonymous