Created
February 20, 2012 18:15
-
-
Save fduran/1870429 to your computer and use it in GitHub Desktop.
Linux disk space email alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# www.fduran.com | |
# script that will send an email to EMAIL when disk use in partition PART is bigger than %MAX | |
# adapt these 3 parameters to your case | |
MAX=95 | |
[email protected] | |
PART=sda1 | |
USE=`df -h |grep $PART | awk '{ print $5 }' | cut -d'%' -f1` | |
if [ $USE -gt $MAX ]; then | |
echo "Percent used: $USE" | mail -s "Running out of disk space" $EMAIL | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
atural91 it won't work on newer distros of linux, have tried on Ubuntu 18.04, got the same error, plenty of software which starts with Ubuntu on boot and sends out emails, just search Github.