Email alert on disk space outage in linux

For Send mail Tutorial Click Here

Need to be installed sendmail ( yum install sendmail) and mailx (yum install mailx)

Create a shell script in linux.


# set alert level 90% is default
df -HP | grep -vE ‘^Filesystem|tmpfs|cdrom’ |
  while read partition size used free perc mnt ;
    usep=$(echo $perc | tr -d ‘%’ )
    if [ $usep -ge $ALERT ]; then
      echo “Running out of space “$partition ($usep%)” on $(hostname) as
  on $(date)” |
       mail -s “Alert: Almost out of disk space – $usep%” $support
Now make this script executable as below.
chmod 777
and now set the cron job as follows.
0 09 * * * /


Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

26 thoughts on “Email alert on disk space outage in linux

Leave a Reply