If you have hosted your website on a VPS or a dedicated server, you might like to get an update if the current backup disk-space limit exceeds.
Email alert script
So here is a step by step process to create a disk-space monitoring script that can send you an email if the backup limit exceeds.
You must be already having root access to your server.
Step: 1. Login to your server with SSH
Step: 2. Run the following commands to create a script:
touch /etc/cron.daily/backupDiskCheck.cron chmod 755 /etc/cron.daily/backupDiskCheck.cron
Step: 3. Now by using a text editor like 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
Step: 4. If you were following along and using nano to edit this file, you can now press Ctrl-O to bring up the write file dialog, and then press Enter to save the changes.
Now once a day your server will check to see if the disk-space usage is over the current level of automatic backups or not.
If the limit exceeds, you will receive an email at the email address you entered in the script.