---
title: "Send email alert when backup limit exceeded"
description: "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..."
url: https://www.inmotionhosting.com/support/email/email-alert-backup-limit-exceeded/
date: 2013-09-03
modified: 2021-10-20
author: "InMotion Hosting Contributor"
categories: ["Backups and Restorations", "Email", "Website"]
type: post
lang: en
---

# Send email alert when backup limit exceeded

If you’re on a [VPS](https://www.inmotionhosting.com/vps-hosting) or [dedicated server](https://www.inmotionhosting.com/dedicated-servers) and paying for our [automatic backup service](https://www.inmotionhosting.com/support/backups-and-restorations/), 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](/support/server/ssh/root-access-faq/) to your server already.
 

1. Login to your server with [SSH](/support/server/ssh/how-to-login-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](/support/server/ssh/how-to-edit-files-using-nano/) create the following script: nano /etc/cron.daily/backupDiskCheck.cron   Change the **user@example.com** address and the **10** threshold below: #!/bin/bash ADMIN="user@example.com" THRESHOLD=10 df -h | awk '//$/ {print $3,$NF}' | while read output; do usedDisk=$(echo $output | awk '{print $1}' | sed 's#G##') partition=$(echo $output | awk '{print $2}') if [ $usedDisk -ge $THRESHOLD ] && [ $partition = "/" ] then 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 fi done
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 vps0123.inmotionhosting.com is currently OVER the 10G automatic backup limit, and is using 28G on the / partition.
