Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Regd: Email alret when hard disk full


    Hi All,

    I have installed & configured ubuntu 12.04(LTS) server successfully.

    Now i want to get email alert when my server hard disk gets full.

    Please advice me how to configure it


    Regards

    Jeyachandran M

  2. #2
    Linux Newbie
    Join Date
    Sep 2012
    Location
    Nashville, TN
    Posts
    100
    I don't take credit for the following script. I found this on Linux Journal. But I have tested and it works on both Mac OS X and Linux
    Code:
    #!/bin/bash
    CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
    THRESHOLD=90
    
    if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
        mail -s 'Disk Space Alert' mailid@domainname.com << EOF
    Your root partition remaining free space is critically low. Used: $CURRENT%
    EOF
    fi
    save this to a script then add it to a cron job and have it test like every 5 minutes or 10 minutes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •