InMotion Hosting Support Center
If you're on a VPS or dedicated server and paying for our automatic backup service, you might like to know when you've gone over the current backup disk-space limit you're paying for.

Email alert script

Below we'll create a disk-space monitoring script that can email us when our backup limit is exceeded.

This requires having root access to your server already.

  1. Login to your server with SSH
  2. Run the following commands to create our script:
    touch /etc/cron.daily/backupDiskCheck.cron
    chmod 755 /etc/cron.daily/backupDiskCheck.cron
  3. Now using a text editor like nano create the following script:
    nano /etc/cron.daily/backupDiskCheck.cron


    Change the address and the 10 threshold below:

    df -h | awk '/\/$/ {print $3,$NF}' | while read output;
      usedDisk=$(echo $output | awk '{print $1}' | sed 's#G##')
      partition=$(echo $output | awk '{print $2}')
      if [ $usedDisk -ge $THRESHOLD ] && [ $partition = "/" ]
        echo "$(date +%d/\%h/%Y" "%T): Your server $(hostname) is OVER the \
        $(echo $THRESHOLD)G automatic backup limit, you're using $(echo $usedDisk)G on \
        the $partition partition." | mail -s"Alert: Over Automatic Backup limit" $ADMIN
  4. If you were following along and using nano to edit this file, you can now hit Ctrl-O to bring up the write file dialog, and then hit Enter to save your changes.

Now once a day your server should check to see if the disk-space usage is over the current level of automatic backups you're paying for.

If it does exceed this limit, then you should receive an email at the address you entered with a message like:

03/Sep/2013 16:28:04: Your server is currently OVER the 10G automatic backup limit, and is using 28G on the / partition.
Was this article helpful?

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!